lua 获取PUT参数值

if "GET" == request_method then

args = ngx.req.get_uri_args()   

elseif "POST" == request_method then

ngx.req.read_body()
args = ngx.req.get_post_args()

end
是否有像上述代码这样的方法,获取PUT参数值,万分感谢

阅读 3.5k
2 个回答

PUT 你就按照 POST 的方式来处理就好了

    lua_need_request_body on; 
    location = /test {
        content_by_lua '
            ngx.say("hello"..ngx.var.request_method)
            data = ngx.req.get_post_args()
            ngx.say(data.nihao)                                                                                                      
        ';  
    }

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进