【发布时间】:2016-06-29 08:23:47
【问题描述】:
以下节点 js 代码运行良好并获得所有需要的结果。
但是当我在定义的代理设置下运行计算机中的代码时。它没有给出结果。
var options: https.RequestOptions = {
host: item.hostname,
port: +item.port,
path: item.path,
method: 'POST',
headers: newHeader
}
var req = https.request(options, function(res){
if(res.statusCode !== 200){
//reject();
//return;
}
var result = '';
res.setEncoding('utf8');
res.on('data', function(chunk){
result += chunk;
});
res.on('end', function(){
resolve(result);
});
res.on('error', function(e){
reject(e);
});
});
如何在 http 模块中启用代理支持在 NODE JS 中请求它检查是否定义了任何代理并执行启用的请求。
options data in debug mode :
headers:Object
Accept:"application/json;api-version=3.0-preview.1"
Content-Length:104
Content-Type:"application/json"
host:"marketplace.visualstudio.com"
method:"POST"
path:"/_apis/public/gallery/extensionquery"
port:0
【问题讨论】:
标签: javascript node.js proxy typescript visual-studio-code