Skip to content

Commit

Permalink
增加 HEAD 路由支持,可以用来做健康检测 head /health
Browse files Browse the repository at this point in the history
  • Loading branch information
RiverDanceGit authored and liu21st committed Jul 5, 2022
1 parent 6619eac commit 68cd1b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/think/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,18 @@ public function patch(string $rule, $route): RuleItem
return $this->rule($rule, $route, 'PATCH');
}

/**
* 注册HEAD路由
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @return RuleItem
*/
public function head(string $rule, $route): RuleItem
{
return $this->rule($rule, $route, 'HEAD');
}

/**
* 注册OPTIONS路由
* @access public
Expand Down
1 change: 1 addition & 0 deletions src/think/facade/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* @method static RuleItem put(string $rule, mixed $route) 注册PUT路由
* @method static RuleItem delete(string $rule, mixed $route) 注册DELETE路由
* @method static RuleItem patch(string $rule, mixed $route) 注册PATCH路由
* @method static RuleItem head(string $rule, mixed $route) 注册HEAD路由
* @method static RuleItem options(string $rule, mixed $route) 注册OPTIONS路由
* @method static Resource resource(string $rule, string $route) 注册资源路由
* @method static RuleItem view(string $rule, string $template = '', array $vars = []) 注册视图路由
Expand Down

0 comments on commit 68cd1b0

Please sign in to comment.