This commit is contained in:
2020-09-17 14:26:38 +08:00
parent fbec7dddc8
commit 28a920841a
+9 -4
View File
@@ -98,13 +98,12 @@ class Response extends Application
/**
* @param $key
* @param $value
* @return Response
*/
public function addHeader($key, $value)
{
if ($this->isClient()) {
return;
}
$this->response->header($key, $value);
$this->headers[$key] = $value;
return $this;
}
/**
@@ -184,6 +183,12 @@ class Response extends Application
$this->response->status($status);
$this->response->header('Content-Type', $this->getContentType());
$this->response->header('Run-Time', $this->getRuntime());
if (!empty($this->headers)) {
foreach ($this->headers as $key => $header) {
$this->response->header($key, $header);
}
$this->headers = [];
}
if (empty($sendData)) {
$sendData = '';
}