This commit is contained in:
2020-09-04 18:44:01 +08:00
parent 412ebc1afc
commit 1d7cc3fa81
3 changed files with 19 additions and 15 deletions
+2 -2
View File
@@ -59,7 +59,7 @@ class Router extends Application implements RouterInterface
if ($first !== '/') {
$parent = $this->bindNode($parent, $explode, $method);
}
return $parent->bindHandler($handler);
return $parent->bindHandler($handler, $method);
}
/**
@@ -429,7 +429,7 @@ class Router extends Application implements RouterInterface
if (!in_array($request->getMethod(), $node->method)) {
return JSON::to(405, 'Method not allowed.');
}
if (empty($node->callback)) {
if (empty($node->callback) || isset($node->callback[$request->getMethod()])) {
return JSON::to(404, 'Method does not exist.');
}
return call_user_func($node->callback, $request);