From 07e5efed58c9ffda8183b788263492b6aef4b1cf Mon Sep 17 00:00:00 2001 From: ctfang Date: Sun, 29 Sep 2019 16:32:24 +0800 Subject: [PATCH 1/2] fix: Write Headers to co response At send file --- src/http-message/src/Response.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/http-message/src/Response.php b/src/http-message/src/Response.php index 80821e03b..fd17e4489 100644 --- a/src/http-message/src/Response.php +++ b/src/http-message/src/Response.php @@ -163,6 +163,14 @@ public function send(): void if ($this->filePath) { $this->sent = true; + // Write Headers to co response + foreach ($this->getHeaders() as $key => $value) { + $headerLine = implode(';', $value); + + if ($key !== ContentType::KEY) { + $this->coResponse->header($key, $headerLine); + } + } // Do send file $this->coResponse->header(ContentType::KEY, $this->fileType); $this->coResponse->sendfile($this->filePath); From 00884348806ea57f38147ebb27ac48784c8764ea Mon Sep 17 00:00:00 2001 From: Inhere Date: Sun, 29 Sep 2019 18:32:23 +0800 Subject: [PATCH 2/2] Update Response.php --- src/http-message/src/Response.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/http-message/src/Response.php b/src/http-message/src/Response.php index fd17e4489..dfb90ef9c 100644 --- a/src/http-message/src/Response.php +++ b/src/http-message/src/Response.php @@ -171,6 +171,7 @@ public function send(): void $this->coResponse->header($key, $headerLine); } } + // Do send file $this->coResponse->header(ContentType::KEY, $this->fileType); $this->coResponse->sendfile($this->filePath);