add clear
This commit is contained in:
@@ -465,18 +465,11 @@ class HttpClient
|
|||||||
private function resolve($data, $body)
|
private function resolve($data, $body)
|
||||||
{
|
{
|
||||||
$type = $data['Content-Type'] ?? $data['content-type'];
|
$type = $data['Content-Type'] ?? $data['content-type'];
|
||||||
if (is_array($body)) {
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
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) {
|
} else if (strpos($type, 'xml') !== false) {
|
||||||
$data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA);
|
$data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||||
$encode = json_encode($data);
|
return json_decode(json_encode($data), TRUE);
|
||||||
if (is_array($encode)) {
|
|
||||||
return $encode;
|
|
||||||
}
|
|
||||||
return json_decode($encode, 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