Comparing version 2.1.4 to 2.1.5
@@ -197,6 +197,4 @@ 'use strict'; | ||
this.body = undefined; | ||
if (_proxy2.default.usingProxy) { | ||
this.agent = _proxy2.default.agent(u); | ||
debug('proxy: %j', this.agent.options); | ||
} | ||
this.agent = _proxy2.default.agent(this.protocol === 'https:'); | ||
if (this.agent) debug('proxy: %j', this.agent.options); | ||
} | ||
@@ -203,0 +201,0 @@ |
@@ -34,15 +34,2 @@ 'use strict'; | ||
static findTunnel(urlParsed) { | ||
let tunnel = require('tunnel-agent'); | ||
return urlParsed.protocol === 'https:' ? tunnel.httpsOverHttp : tunnel.httpOverHttp; | ||
} | ||
static findProxy(urlParsed) { | ||
if (urlParsed.protocol === 'https:') { | ||
return this.httpsProxy || this.httpProxy; | ||
} else { | ||
return this.httpProxy; | ||
} | ||
} | ||
static get sslCertDir() { | ||
@@ -68,7 +55,9 @@ const certDir = this.env.SSL_CERT_DIR; | ||
static agent(urlParsed) { | ||
const u = this.findProxy(urlParsed); | ||
static agent(https) { | ||
if (!this.usingProxy) return; | ||
const u = https ? this.httpsProxy || this.httpProxy : this.httpProxy; | ||
if (u) { | ||
let proxyParsed = _url2.default.parse(u); | ||
let tunnelMethod = this.findTunnel(urlParsed); | ||
let tunnel = require('tunnel-agent'); | ||
let tunnelMethod = https ? tunnel.httpsOverHttp : tunnel.httpOverHttp; | ||
let opts = { | ||
@@ -90,3 +79,3 @@ proxy: { | ||
let tunnelAgent = tunnelMethod(opts); | ||
if (urlParsed.protocol === 'https:') { | ||
if (https) { | ||
tunnelAgent.defaultPort = 443; | ||
@@ -93,0 +82,0 @@ } |
{ | ||
"name": "http-call", | ||
"description": "make http requests", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"author": "Jeff Dickey @dickeyxxx", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/dickeyxxx/http-call/issues", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
22450
324