You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/02/08 08:49:04 UTC

[GitHub] [apisix] tokers commented on a change in pull request #3556: feat: support rewrite HTTP method

tokers commented on a change in pull request #3556:
URL: https://github.com/apache/apisix/pull/3556#discussion_r571868236



##########
File path: apisix/plugins/proxy-rewrite.lua
##########
@@ -178,6 +183,28 @@ function _M.rewrite(conf, ctx)
         ctx.var.upstream_uri = upstream_uri
     end
 
+    -- enum    = {"GET", "POST","PUT","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 == "DELETE" then
+        ngx.req.set_method(ngx.HTTP_DELETE)
+      else

Review comment:
       Seems the if else judgements are not complete, the `PATCH` method should also be supported.

##########
File path: apisix/plugins/proxy-rewrite.lua
##########
@@ -178,6 +183,28 @@ function _M.rewrite(conf, ctx)
         ctx.var.upstream_uri = upstream_uri
     end
 
+    -- enum    = {"GET", "POST","PUT","DELETE"}
+    -- change Http method
+    if conf.method ~=nil then

Review comment:
       Style: missing empty space before `nil`.




----------------------------------------------------------------
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:
users@infra.apache.org