Unirest-设置代理 [英] Unirest - Setting proxy

查看:569
本文介绍了Unirest-设置代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 unirest 为其余请求设置一次代理?我得到Request.proxy is not a function

How do I set a proxy once for the rest of the requests with unirest? I get Request.proxy is not a function

var Request = require('unirest');
Request.proxy('217.23.3.15:11100');
unirest.get('https://api.ipify.org/t')
.end(function (response) {
 console.log(response.body);
 });

推荐答案

这将很好地工作:

    unirest.get('https://api.ipify.org/t')
    .proxy('http://217.23.3.15:11100')
    .end(function (response) {
      console.log(response.body);
    });

这篇关于Unirest-设置代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆