openresty capture,openresty


local args = {}
args["name"] = "张三"
args["sex"] = ""

local captureRes;
if ngx.var.request_method == "POST" then
    captureRes = ngx.location.capture('/dsideal_yy/test', {method = ngx.HTTP_POST, headers = { ["Content-Type"] = "application/x-www-form-urlencoded" }, body = ngx.encode_args(args)})
else
    captureRes = ngx.location.capture('/dsideal_yy/test', {method = ngx.HTTP_GET, args = args})
end

if captureRes.status == 200 then
    local ret = cjson.decode(captureRes.body)
end

 

相关内容