Skip to content

Latest commit

 

History

History
30 lines (16 loc) · 1.2 KB

ngxreqset_method.md

File metadata and controls

30 lines (16 loc) · 1.2 KB

ngx.req.set_method

语法: ngx.req.set_method(method_id)

环境: set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*

method_id 参数的值改写当前请求的 HTTP 请求方法。当前仅支持 HTTP 请求方法 中定义的数值常量,例如 ngx.HTTP_POSTngx.HTTP_GET

如果当前请求是 Nginx 子请求,子请求的 HTTP 请求方法将被改写。

这个方法在 v0.5.6 版本中首次引入。

更多用法请参考 ngx.req.get_method

English Source

syntax: ngx.req.set_method(method_id)

context: set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*

Overrides the current request's request method with the method_id argument. Currently only numerical method constants are supported, like ngx.HTTP_POST and ngx.HTTP_GET.

If the current request is an Nginx subrequest, then the subrequest's method will be overridden.

This method was first introduced in the v0.5.6 release.

See also ngx.req.get_method.

返回目录