tokers commented on a change in pull request #3556:
URL: https://github.com/apache/apisix/pull/3556#discussion_r571908719
##########
File path: apisix/plugins/proxy-rewrite.lua
##########
@@ -178,6 +183,31 @@ function _M.rewrite(conf, ctx)
ctx.var.upstream_uri = upstream_uri
end
+ -- enum = {"GET", "POST","PUT",""PATCH,"DELETE"}
+ -- change HTTP method
+ if conf.method ~=nil then
+
+ if conf.method == "GET" then
+ ngx.req.set_method(ngx.HTTP_GET)
+
+ elseif conf.method == "POST" then
+ ngx.req.set_method(ngx.HTTP_POST)
+
+ elseif conf.method == "PUT" then
+ ngx.req.set_method(ngx.HTTP_PUT)
+
+ elseif conf.method == "PATCH" then
+ ngx.req.set_method(ngx.HTTP_PATCH)
+
+ elseif conf.method == "DELETE" then
+ ngx.req.set_method(ngx.HTTP_DELETE)
+ else
+ core.log.warn("Invalid HTTP method: ", conf.method)
+ end
+
+ core.log.info("HTTP method changed to: ", conf.method)
Review comment:
I think the original HTTP method also should be printed.
```suggestion
core.log.info("changed HTTP method from ", old_method, " to ",
conf.method)
```
##########
File path: apisix/plugins/proxy-rewrite.lua
##########
@@ -197,6 +227,7 @@ function _M.rewrite(conf, ctx)
ngx.req.set_header(conf.headers_arr[i],
core.utils.resolve_var(conf.headers_arr[i+1],
ctx.var))
end
+
Review comment:
This empty line is redundant.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]