This commit is contained in:
2020-09-09 11:44:14 +08:00
parent cb7ae39786
commit f2b09eebf0
4 changed files with 56 additions and 5 deletions
+7 -2
View File
@@ -417,11 +417,16 @@ class Router extends Application implements RouterInterface
*/
public function dispatch()
{
/** @var Node $node */
$request = Context::getContext('request');
if (!($node = $this->find_path($request))) {
return JSON::to(404, self::NOT_FOUND);
return send(JSON::to(404, self::NOT_FOUND));
}
return $node->dispatch();
$response = send($node->dispatch(), 200);
if ($node->hasAfter()) {
$node->afterDispatch($response);
}
return $response;
}