Solo  当前访客:2 开始使用

使用request库调用代理发送请求


代理参数

proxy 类型 urlString 或者object

{
 hostname: '',
 port: ''
}

demo

request(Object.assign({
            url:this.wxHook,
            method:"POST", json:true, body:params},
            this.proxy ? {proxy: {hostname: this.proxy, port: "80"}} : {}
        ), function (error, response, body) {
            if(error) {
                logger.error("消息发送失败"+error)
                return;
            }
            if(response && response.statusCode === 200) {
                logger.info(`prod: send EWX to ${mobiles} success, params:${JSON.stringify(params)}`)
            } else {
                logger.info(`prod: send EWX to ${mobiles} failure, body:${JSON.stringify(body)}`)
            }

        });


标题:使用request库调用代理发送请求
作者:hugh0524
地址:https://blog.uproject.cn/articles/2020/01/02/1577952839058.html

, , , 0 0