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