From 4c159f6a06b20eb5ef5b6b042823f8da748b4a4e Mon Sep 17 00:00:00 2001 From: Christophe Moine Date: Sat, 10 Nov 2012 15:28:41 +0100 Subject: [PATCH] Use env proxy if defined --- lib/pull-request.js | 7 ++++++- lib/util/github.js | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pull-request.js b/lib/pull-request.js index 8a57996..9206774 100644 --- a/lib/pull-request.js +++ b/lib/pull-request.js @@ -70,8 +70,13 @@ PullRequest.prototype.setExport = function (callback) { } PullRequest.prototype.getDiff = function (callback) { + var req = {}; + req.url = this.data.diff_url; + if (process.env.http_proxy) { + req.proxy = process.env.http_proxy; + } - request(this.data.diff_url, function (err, res, body) { + request(req, function (err, res, body) { if (err) return callback(err); this.exports.diff = body; callback(null, body); diff --git a/lib/util/github.js b/lib/util/github.js index 9b20c52..ec21d16 100644 --- a/lib/util/github.js +++ b/lib/util/github.js @@ -41,6 +41,9 @@ var github = function (path, options, callback) { else req.body = JSON.stringify(options); } + if (process.env.http_proxy) { + req.proxy = process.env.http_proxy; + } req.url = 'https://api.github.com' + path; req.json = true; req.method = method;