zhangweidongyyl opened a new issue #5691:
URL: https://github.com/apache/apisix/issues/5691
### Issue description
` local function push_data(premature, args)
httpc, err = http:new() --
创建 http 连接对象
httpc:set_timeout(time) --
注意名字里有一个下划线
httpc:set_timeout(connect_timeout, -- 同上
send_timeout, read_timeout)
local res, err = httpc:request_uri( --
发送 HTTP 请求,默认是 GET
'http://www.baidu.com',
-- 指定 IP 地址
{path = '/echo', --
指定具体路径
query = {name = 'chrono'}} --
请求的参数,使用 Lua 表
)
if not res then --
检查请求是否成功
core.log.error("failed to request : ", err)
return
end
core.log.info("args:", type(args))
core.log.info("res.body:",res.body)
-- 输出响应体
end
local resp = ""
local ok, err = ngx.timer.at(0, push_data, ngx.var.args)
if not ok then
ngx.log(ngx.ERR, "failed to create timer: ", err)
return
end
ngx.arg[1] = "success"
ngx.arg[2] = true`
how i set res.body for global
### Environment
- apisix version (cmd: `apisix version`):
- OS (cmd: `uname -a`):
- OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
- etcd version, if have (cmd: run `curl
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
- apisix-dashboard version, if have:
- the plugin runner version, if the issue is about a plugin runner (cmd:
depended on the kind of runner):
- luarocks version, if the issue is about installation (cmd: `luarocks
--version`):
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]