This commit is contained in:
as2252258@163.com
2021-06-26 02:48:11 +08:00
parent 84d120de92
commit 2f17c40444
+14 -1
View File
@@ -264,7 +264,7 @@ class Router extends HttpService implements RouterInterface
public function any($route, $handler): Any
{
$nodes = [];
foreach (['get', 'post', 'options', 'put', 'delete'] as $method) {
foreach (['get', 'post', 'options', 'put', 'delete', 'head'] as $method) {
$nodes[] = $this->addRoute($route, $handler, $method);
}
return new Any($nodes);
@@ -281,6 +281,19 @@ class Router extends HttpService implements RouterInterface
return $this->addRoute($route, $handler, 'delete');
}
/**
* @param $route
* @param $handler
* @return \HttpServer\Route\Node|null
* @throws \Exception
*/
public function head($route, $handler): ?Node
{
return $this->addRoute($route, $handler, 'head');
}
/**
* @param $route
* @param $handler