diff --git a/HttpServer/Events/OnRequest.php b/HttpServer/Events/OnRequest.php index 7c1f578a..7b7d3e19 100644 --- a/HttpServer/Events/OnRequest.php +++ b/HttpServer/Events/OnRequest.php @@ -40,14 +40,7 @@ class OnRequest extends Callback if ($sRequest->is('favicon.ico')) { return $sResponse->send($sRequest->isNotFound(), 200); } - $node = Snowflake::app()->router->dispatch(); - if (!($node instanceof Node)) { - return $sResponse->send($node, 200); - } - $sResponse->send($content = $node->dispatch(), 200); - if ($node->hasAfter()) { - $node->afterDispatch($content); - } + $sResponse->send(Snowflake::app()->router->dispatch(), 200); } catch (Error | \Throwable $exception) { $this->sendErrorMessage($sResponse ?? null, $exception, $response); } finally { diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index f4f8ba7b..09b05791 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -420,7 +420,7 @@ class Router extends Application implements RouterInterface if (empty($node->callback)) { return JSON::to(404, 'Page not found.'); } - return $node; + return $node->dispatch(); }