如何使用unirest为其余请求设置一次代理?我得到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);
});
答案 0 :(得分:0)
Unirest现在支持http代理。代码如下:
var Request = require('unirest');
Request.proxy('http://217.23.3.15:11100');
unirest.get('https://api.ipify.org/t')
.end(function (response) {
console.log(response.body);
});
一旦声明
,每个请求都会通过代理传递Request.proxy('http://217.23.3.15:11100');
答案 1 :(得分:0)
这可以正常工作:
unirest.get('https://api.ipify.org/t')
.proxy('http://217.23.3.15:11100')
.end(function (response) {
console.log(response.body);
});