This commit is contained in:
2021-12-24 14:19:20 +08:00
parent 1d1b36155a
commit 4f99ec5756
+17 -3
View File
@@ -122,9 +122,7 @@ class AsyncClient extends ClientAbstracts
$status = array_shift($header); $status = array_shift($header);
$this->setStatusCode(intval(explode(' ', $status)[1])); $this->setStatusCode(intval(explode(' ', $status)[1]));
$this->setResponseHeader($header); $this->parseResponseHeaders($header);
var_dump($this->getResponseHeaders());
if ($this->getResponseHeader('Transfer-Encoding') == 'chunked') { if ($this->getResponseHeader('Transfer-Encoding') == 'chunked') {
$explode = explode("\r\n\r\n", str_replace("0\r\n\r\n", '', $body)); $explode = explode("\r\n\r\n", str_replace("0\r\n\r\n", '', $body));
@@ -141,6 +139,22 @@ class AsyncClient extends ClientAbstracts
} }
/**
* @param array $headers
* @return void
*/
private function parseResponseHeaders(array $headers)
{
$array = [];
foreach ($headers as $header) {
[$key, $value] = explode(': ', $header);
$array[$key] = $value;
}
$this->setResponseHeader($array);
}
/** /**
* @param $path * @param $path
* @param $data * @param $data