码迷,mamicode.com
首页 > Web开发 > 详细

openresty http

时间:2020-01-09 15:57:14      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:headers   github   参数   第三方   url   soc   文件   pos   open   

openresty http

  • openresty默认没有提供http客户端,需要第三方提供插件。
  • 下载方式:
wget?https://raw.githubusercontent.com/pintsized/lua-resty-http/master/lib/resty/http_headers.lua??
wget?https://raw.githubusercontent.com/pintsized/lua-resty-http/master/lib/resty/http.lua??
  • 将文件放在 /openresty/lualib/resty/目录下即可
  • 使用方式
local res, err = httpc:request_uri(uri, {  
    method = "POST/GET",  ---请求方式
    query = str,  ---get方式传参数
    body = str,     ---post方式传参数
    path = "url" ----路径
    headers = {  ---header参数
        ["Content-Type"] = "application/json",  
    }  
})

openresty http

标签:headers   github   参数   第三方   url   soc   文件   pos   open   

原文地址:https://www.cnblogs.com/frankltf/p/12171855.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!