This commit is contained in:
2021-08-05 18:00:22 +08:00
parent 9bb0181bd2
commit 6c33df603e
+1 -2
View File
@@ -117,13 +117,12 @@ class HTTPServerListener extends Abstracts\Server
public function onRequest(Request $request, Response $response) public function onRequest(Request $request, Response $response)
{ {
try { try {
var_dump($request);
$node = $this->router->Branch_search(HSRequest::create($request)); $node = $this->router->Branch_search(HSRequest::create($request));
if (!($node instanceof Node)) { if (!($node instanceof Node)) {
throw new RequestException('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', 404); throw new RequestException('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', 404);
} }
if (!(($responseData = $node->dispatch()) instanceof ResponseInterface)) { if (!(($responseData = $node->dispatch()) instanceof ResponseInterface)) {
$responseData = $this->response->setContent($node->dispatch())->setStatusCode(200); $responseData = $this->response->setContent($responseData)->setStatusCode(200);
} }
} catch (Error | Throwable $exception) { } catch (Error | Throwable $exception) {
$responseData = $this->exceptionHandler->emit($exception, $this->response); $responseData = $this->exceptionHandler->emit($exception, $this->response);