add clear
This commit is contained in:
@@ -528,6 +528,9 @@ class HttpClient
|
|||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
$type = $data['content-type'];
|
$type = $data['content-type'];
|
||||||
|
if ($this->isXml($body)) {
|
||||||
|
return Help::toArray($body);
|
||||||
|
}
|
||||||
if (strpos($type, 'text/html') !== false) {
|
if (strpos($type, 'text/html') !== false) {
|
||||||
return $body;
|
return $body;
|
||||||
} else if (strpos($type, 'json') !== false) {
|
} else if (strpos($type, 'json') !== false) {
|
||||||
@@ -540,6 +543,11 @@ class HttpClient
|
|||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function isXml($body)
|
||||||
|
{
|
||||||
|
return preg_match('/^<[a-zA-Z_]+>(.*?)?<\/[a-zA-Z_]+>$/', $body);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $headers
|
* @param $headers
|
||||||
* @return array
|
* @return array
|
||||||
|
|||||||
Reference in New Issue
Block a user