This commit is contained in:
2020-09-08 13:58:22 +08:00
parent ff3b50f61a
commit ae687d4ba9
2 changed files with 4 additions and 3 deletions
+4
View File
@@ -9,6 +9,7 @@ use HttpServer\Http\Request;
use Exception;
use HttpServer\Application;
use HttpServer\Route\Annotation\Annotation;
use Snowflake\Core\JSON;
use Snowflake\Snowflake;
/**
@@ -415,6 +416,9 @@ class Node extends Application
*/
public function dispatch()
{
if (empty($node->callback)) {
return JSON::to(404, 'Page not found.');
}
return call_user_func($this->callback, \request());
}
-3
View File
@@ -417,9 +417,6 @@ class Router extends Application implements RouterInterface
if (!($node = $this->find_path($request))) {
return JSON::to(404, 'Page not found or method not allowed.');
}
if (empty($node->callback)) {
return JSON::to(404, 'Page not found.');
}
return $node->dispatch();
}