close connection

This commit is contained in:
2022-06-27 03:29:14 +08:00
parent 281a59b7af
commit 136666e182
+6 -1
View File
@@ -33,15 +33,17 @@ local function get_access_token()
})
ngx.log(ngx.INFO, "RESP -> ", pl.write(resp))
httpc:close()
if no_exception == true then
if 200 ~= resp.status then
ngx.log(ngx.ERR, "GET ACCESS TOKEN *FAILED*", pl.write(resp_err))
ngx.status = resp.status
ngx.say(pl.write(resp_err))
--httpc:close()
ngx.exit(resp.status)
else
ngx.log(ngx.ERR, "RESP IS OK -> ", pl.write(resp.body))
--httpc:close()
return cjson.decode(resp.body).d
end
else
@@ -53,8 +55,11 @@ local function get_access_token()
-- https://github.com/openresty/lua-resty-redis/issues/15
ngx.status = 401
ngx.say(cjson.encode({r = false, d = "HtySudoerTokenErr"}))
--httpc:close()
ngx.exit(401)
end
end
local function get_wx_media(media_id)