This commit is contained in:
2025-07-21 17:26:51 +08:00
parent 3251045a5b
commit 926cbea0b9
4 changed files with 22 additions and 20 deletions
-12
View File
@@ -7,7 +7,6 @@ use Kiri\Core\Help;
use Kiri\Router\ContentType;
use Kiri\Router\StreamResponse;
use Psr\Http\Message\ResponseInterface;
use Swoole\Http\Response;
class ConstrictResponse extends Message implements ResponseInterface
@@ -20,18 +19,11 @@ class ConstrictResponse extends Message implements ResponseInterface
private string $reasonPhrase;
/**
* @var array|mixed
*/
public array $headers = [];
/**
* @param ContentType|null $contentType
*/
public function __construct(?ContentType $contentType = null)
{
$this->headers = \config('response.headers', $this->headers);
if ($contentType != null) {
$this->withHeader('Content-Type', $contentType->toString());
}
@@ -215,10 +207,6 @@ class ConstrictResponse extends Message implements ResponseInterface
*/
public function end(object $response): void
{
/** @var Response $response */
if (count($this->headers) > 0) foreach ($this->headers as $key => $header) {
$response->header($key, $header);
}
$response->end($this->stream->getContents());
}
}