This commit is contained in:
2021-08-04 16:39:39 +08:00
parent 98ada1938e
commit e353fbc41e
+1 -2
View File
@@ -9,7 +9,6 @@ use HttpServer\Http\Request as HSRequest;
use HttpServer\Route\Node;
use HttpServer\Route\Router;
use ReflectionException;
use Server\Abstracts\PageNotFoundException;
use Server\Constrict\Response as CResponse;
use Server\Events\OnAfterRequest;
use Snowflake\Abstracts\Config;
@@ -120,7 +119,7 @@ class HTTPServerListener extends Abstracts\Server
try {
$node = $this->router->find_path(HSRequest::create($request));
if (!($node instanceof Node)) {
throw new PageNotFoundException(404);
throw new RequestException('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', 404);
}
$responseData = $this->response->setContent($node->dispatch())->setStatusCode(200);
} catch (Error | Throwable $exception) {