From b4f6d1be35da96db914b94c343e6b78111ae344c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 4 Jan 2021 18:26:47 +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/Events/OnRequest.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/HttpServer/Events/OnRequest.php b/HttpServer/Events/OnRequest.php index 0f4dd44e..ca9b5a57 100644 --- a/HttpServer/Events/OnRequest.php +++ b/HttpServer/Events/OnRequest.php @@ -4,21 +4,16 @@ declare(strict_types=1); namespace HttpServer\Events; -use Annotation\Route\After; use Exception; use HttpServer\Abstracts\Callback; -use HttpServer\Events\Utility\AfterRequest; use HttpServer\Exception\ExitException; use HttpServer\Http\Request as HRequest; use HttpServer\Http\Response as HResponse; use ReflectionException; -use Snowflake\Async; -use Snowflake\Core\Json; use Snowflake\Event; use Snowflake\Exception\ComponentException; use Snowflake\Exception\NotFindClassException; use Snowflake\Snowflake; -use Swoole\Coroutine; use Swoole\Error; use Swoole\Http\Request; use Swoole\Http\Response; @@ -42,13 +37,13 @@ class OnRequest extends Callback try { [$req, $rep] = static::create($request, $response); if ($req->is('favicon.ico')) { - send(null, 404); + \send(null, 404); } else { - router()->dispatch(); + \router()->dispatch(); } } catch (ExitException | Error | \Throwable $exception) { if ($exception instanceof ExitException) { - send($exception->getMessage(), $exception->getCode()); + \send($exception->getMessage(), $exception->getCode()); } else { $this->sendErrorMessage($exception); }