Advertisement

apisix 测试和训练GET请求(其中包含HEAD方法)

阅读量:

本文件为个人博客系统文档的备份版本,作者为小游,作者博客地址为点击访问

复制代码
    function _M.access(conf, ctx)
    -- 引入resty的http请求模块
    local http = require("resty.http")
    -- 新建一个http请求
    local httpc = http.new()
    -- 负载均衡的节点列表
    local hosts = {}
    hosts["192.168.123.131:81"] = 1
    hosts["192.168.123.131:82"] = 1
    hosts["192.168.123.131:83"] = 1
    hosts["192.168.123.131:84"] = 1
    -- 发送一个http请求
    local resp, err = httpc:request_uri("http://192.168.123.119:82/send", {
        method = "GET",
        headers = {
            -- 设置发送的数据类型
            ["Content-Type"] = "application/j

全部评论 (0)

还没有任何评论哟~