From bf7ba23ba9a7a609a60ee1508b052df2702734ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 6 Sep 2021 18:46:28 +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 --- http-server/Service/Http.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/http-server/Service/Http.php b/http-server/Service/Http.php index 0024c91c..1a1cc177 100644 --- a/http-server/Service/Http.php +++ b/http-server/Service/Http.php @@ -44,12 +44,13 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect try { $request = \Server\Constrict\Request::create($request); $node = $this->router->Branch_search($request); - if (!($node instanceof Node)) { - throw new RequestException('

HTTP 404 Not Found


Powered by Swoole', 404); - } - if (!(($responseData = $node->dispatch($request)) instanceof ResponseInterface)) { - $responseData = $this->transferToResponse($responseData); - } +// if (!($node instanceof Node)) { +// throw new RequestException('

HTTP 404 Not Found


Powered by Swoole', 404); +// } +// if (!(($responseData = $node->dispatch($request)) instanceof ResponseInterface)) { +// $responseData = $this->transferToResponse($responseData); +// } + $responseData = $this->transferToResponse('hello word.'); } catch (Error | \Throwable $exception) { $responseData = $this->exceptionHandler->emit($exception, $this->response); } finally { @@ -60,11 +61,11 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect /** - * @param $responseData + * @param mixed $responseData * @return ResponseInterface * @throws Exception */ - private function transferToResponse($responseData): ResponseInterface + private function transferToResponse(mixed $responseData): mixed { $interface = $this->response->withStatus(200); if (!$interface->hasContentType()) {