From 3e10de58edf83040485942c386460fc1e36d334f Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Tue, 21 Sep 2021 02:50:38 +0800 Subject: [PATCH] 111 --- http-server/Constrict/Response.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/http-server/Constrict/Response.php b/http-server/Constrict/Response.php index 3a805695..f510c0ba 100644 --- a/http-server/Constrict/Response.php +++ b/http-server/Constrict/Response.php @@ -29,11 +29,17 @@ class Response implements ResponseInterface const FILE = 'file'; + /** + * @throws \Kiri\Exception\ConfigException + */ public function __construct() { - $contentType = Config::get('response.format',ContentType::JSON); - - $this->withContentType($contentType)->withCharset('utf-8'); + $contentType = Config::get('response',[ + 'format' => ContentType::JSON, + 'charset' => 'utf-8' + ]); + $this->withContentType($contentType['format']) + ->withCharset($contentType['charset']); }