add clear
This commit is contained in:
@@ -463,18 +463,17 @@ class HttpClient
|
|||||||
*/
|
*/
|
||||||
private function resolve($data, $body)
|
private function resolve($data, $body)
|
||||||
{
|
{
|
||||||
|
$type = $data['Content-Type'] ?? $data['content-type'];
|
||||||
if (is_array($body)) {
|
if (is_array($body)) {
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
$type = $data['Content-Type'] ?? $data['content-type'];
|
|
||||||
if (strpos($type, 'json') !== false) {
|
if (strpos($type, 'json') !== false) {
|
||||||
return json_decode($body, true);
|
return json_decode($body, true);
|
||||||
} else if (strpos($type, 'xml') !== false || strpos($type, 'plain') !== false) {
|
} else if (strpos($type, 'xml') !== false || strpos($type, 'plain') !== false) {
|
||||||
if (!is_null($newBody = json_decode($body, true))) {
|
if (!is_null($newBody = json_decode($body, true))) {
|
||||||
return $newBody;
|
return $newBody;
|
||||||
}
|
}
|
||||||
$data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA);
|
return Help::toArray($body);
|
||||||
return json_decode(json_encode($data), TRUE);
|
|
||||||
} else if (strpos($type, 'plain') !== false) {
|
} else if (strpos($type, 'plain') !== false) {
|
||||||
return json_decode($body, TRUE);
|
return json_decode($body, TRUE);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user