From de07995203d9140c566ca307902917ff56eed57e Mon Sep 17 00:00:00 2001 From: dewanakl Date: Tue, 12 Dec 2023 09:51:34 +0700 Subject: [PATCH] feat: fix headers --- src/Core/Http/Respond.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Core/Http/Respond.php b/src/Core/Http/Respond.php index 1828c7d..a223a28 100644 --- a/src/Core/Http/Respond.php +++ b/src/Core/Http/Respond.php @@ -109,16 +109,19 @@ class Respond * * @param string|null $content * @param int $code - * @param array $header + * @param array $headers * @param string $version * @return void */ - public function __construct(string|null $content = null, int $code = Respond::HTTP_OK, array $header = [], string $version = '1.1') + public function __construct(string|null $content = null, int $code = Respond::HTTP_OK, array $headers = [], string $version = '1.1') { $this->code = $code; - $this->headers = new Header($header); - $this->headers->set('Content-Type', 'text/html'); - $this->headers->set('Date', gmdate(DateTimeInterface::RFC7231)); + $this->headers = new Header([ + 'Content-Type' => 'text/html', + 'Date' => gmdate(DateTimeInterface::RFC7231), + ...$headers + ]); + $this->content = $content; $this->version = $version; $this->message = $this->codeHttpMessage($code);