This commit is contained in:
2020-09-08 12:02:59 +08:00
parent f394d40698
commit ff3b50f61a
2 changed files with 2 additions and 9 deletions
+1 -8
View File
@@ -40,14 +40,7 @@ class OnRequest extends Callback
if ($sRequest->is('favicon.ico')) { if ($sRequest->is('favicon.ico')) {
return $sResponse->send($sRequest->isNotFound(), 200); return $sResponse->send($sRequest->isNotFound(), 200);
} }
$node = Snowflake::app()->router->dispatch(); $sResponse->send(Snowflake::app()->router->dispatch(), 200);
if (!($node instanceof Node)) {
return $sResponse->send($node, 200);
}
$sResponse->send($content = $node->dispatch(), 200);
if ($node->hasAfter()) {
$node->afterDispatch($content);
}
} catch (Error | \Throwable $exception) { } catch (Error | \Throwable $exception) {
$this->sendErrorMessage($sResponse ?? null, $exception, $response); $this->sendErrorMessage($sResponse ?? null, $exception, $response);
} finally { } finally {
+1 -1
View File
@@ -420,7 +420,7 @@ class Router extends Application implements RouterInterface
if (empty($node->callback)) { if (empty($node->callback)) {
return JSON::to(404, 'Page not found.'); return JSON::to(404, 'Page not found.');
} }
return $node; return $node->dispatch();
} }