openresty capture

简介: local args = {} args["name"] = "张三" args["sex"] = "男" local captureRes; if ngx.var.request_method == "POST" then captureRes = ngx.
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

 

相关文章
|
30天前
|
网络协议 应用服务中间件 nginx
FFmpeg错误笔记(一):nginx-rtmp-module推流出现 Server error: Already publishing
这篇文章讨论了在使用nginx-rtmp-module进行RTMP推流时遇到的“Server error: Already publishing”错误,分析了错误原因,并提供了详细的解决办法,包括修改nginx配置文件和终止异常的TCP连接。
102 0
FFmpeg错误笔记(一):nginx-rtmp-module推流出现 Server error: Already publishing
|
应用服务中间件 nginx
Mac Nginx nginx: [error] open() “/usr/local/var/run/nginx.pid“
Mac Nginx nginx: [error] open() “/usr/local/var/run/nginx.pid“
99 1
|
6月前
|
应用服务中间件 nginx C++
nginx: [emerg] unknown directive “rtmp“ in ./../conf/nginx.conf:16
nginx: [emerg] unknown directive “rtmp“ in ./../conf/nginx.conf:16
|
应用服务中间件 nginx
启动nginx时,报错:open() “/etc/nginx/mime.types“ failed
启动nginx时,报错:open() “/etc/nginx/mime.types“ failed
676 0
|
应用服务中间件 nginx C语言
【Nginx报错处理方案】ivalid c++ compiler or c++ compiler flags
【Nginx报错处理方案】ivalid c++ compiler or c++ compiler flags
369 0
|
应用服务中间件 PHP nginx
nginx File not found 错误
使用php-fpm解析PHP,"No input file specified","File not found"是常见错误,原因是php-fpm进程找不到SCRIPT_FILENAME配置的要执行的.php文件,php-fpm返回给nginx的默认404错误提示。
4654 0
|
监控 应用服务中间件 开发工具
|
应用服务中间件 nginx