From 38ac99b497212625ac97109ca887e0d5ba42f91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 16 Sep 2020 20:49:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Http/Response.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index 5426915a..2e07f55c 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -101,15 +101,20 @@ class Response extends Application */ public function addHeader($key, $value) { - if ( - !($this->response instanceof SResponse) || - !($this->response instanceof S2Response) - ) { + if ($this->isClient()) { return; } $this->response->header($key, $value); } + /** + * @return bool + */ + private function isClient() + { + return !($this->response instanceof SResponse) && !($this->response instanceof S2Response); + } + /** * @param string $context * @param int $statusCode