Add proxy support

This commit is contained in:
Yeechan Lu
2017-08-02 15:22:41 +08:00
parent 8dc2b6e8e1
commit 1aa4c8673e
7 changed files with 33 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
var url = require('url');
var https = require('https');
var config = require('../config')
module.exports = function (requestUrl, options, data, cb) {
options = options || {};
@@ -19,6 +19,11 @@ module.exports = function (requestUrl, options, data, cb) {
options.path = parsedUrl.path;
}
if (options.platform) {
options.agent = config.getAgent(options.platform);
delete options.platform;
}
var req = https.request(options, function (res) {
res.setEncoding('utf8');