From 7d804f3a2574de2882bbd02c5bc1db1fadcff44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Apr 2021 11:38:03 +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 | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index cad2ac6f..d53cb717 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -179,16 +179,16 @@ class Response extends HttpService */ private function parseData($context): mixed { - if ($context === null) { - if (isset($this->_format_maps[$this->format])) { - $class['class'] = $this->_format_maps[$this->format]; - } else { - $class['class'] = HtmlFormatter::class; - } - $format = Snowflake::createObject($class); - return $format->send($context)->getData(); + if (empty($context)) { + return $context; } - return $context; + if (isset($this->_format_maps[$this->format])) { + $class['class'] = $this->_format_maps[$this->format]; + } else { + $class['class'] = HtmlFormatter::class; + } + $format = Snowflake::createObject($class); + return $format->send($context)->getData(); } /** @@ -228,7 +228,6 @@ class Response extends HttpService if (!swoole()->exist($response->fd)) { return; } - var_dump($sendData); if (is_array($sendData)) { $sendData = Json::encode($sendData); }