From 691f46bde73ecdbbb2491b22e179d814490c4e93 Mon Sep 17 00:00:00 2001 From: Rashid Omar Date: Thu, 6 Mar 2014 15:35:28 +0000 Subject: [PATCH] Adding the ability to add a custom https agent. --- lib/restler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/restler.js b/lib/restler.js index 895b005..23698ef 100644 --- a/lib/restler.js +++ b/lib/restler.js @@ -71,6 +71,7 @@ function Request(uri, options) { } var proto = (this.url.protocol == 'https:') ? https : http; + var agent = (this.options.agent) ? this.options.agent : undefined; this.request = proto.request({ host: this.url.hostname, @@ -78,7 +79,8 @@ function Request(uri, options) { path: this._fullPath(), method: this.options.method, headers: this.headers, - rejectUnauthorized: this.options.rejectUnauthorized + rejectUnauthorized: this.options.rejectUnauthorized, + agent: agent }); this._makeRequest();