Comparing version 3.2.0-beta to 3.2.0-beta2
@@ -35,2 +35,11 @@ 'use strict'; | ||
this.bodymaker = new bodymaker(options); | ||
this.cert = ''; | ||
this.key = ''; | ||
if (this.ignoretls) { | ||
this.cert = fs.readFileSync(this.config.cert); | ||
this.key = fs.readFileSync(this.config.key); | ||
} | ||
}; | ||
@@ -66,7 +75,6 @@ | ||
urlobj.rejectUnauthorized = false; | ||
} else if (u.protocol === 'https:') { | ||
urlobj.cert = this.cert; | ||
urlobj.key = this.key; | ||
} | ||
else if (u.protocol === 'https:') { | ||
urlobj.cert = fs.readFileSync(this.config.cert); | ||
urlobj.key = fs.readFileSync(this.config.key); | ||
} | ||
@@ -503,6 +511,8 @@ return urlobj; | ||
let uobj = null; | ||
if (url && typeof url === 'object') { | ||
if (typeof url === 'string') { | ||
uobj = this.parseUrl(url); | ||
} else if (url && typeof url === 'object') { | ||
uobj = url; | ||
} else if (typeof url === 'string') { | ||
uobj = this.parseUrl(url); | ||
} else { | ||
@@ -512,3 +522,3 @@ throw new Error('url must be string or a object'); | ||
if (qopts.headers && typeof opts.headers === 'object') { | ||
if (opts.headers && typeof opts.headers === 'object') { | ||
for (let k in opts.headers) { | ||
@@ -544,3 +554,3 @@ uobj.headers[k] = headers[k]; | ||
gohttp.prototype.fastproxy = function (opts, readfrom, writeto, autoend = true) { | ||
gohttp.prototype.fastproxy = function (url, readfrom, writeto, autoend = true) { | ||
let h = (opts.protocol === 'https:') ? https : http; | ||
@@ -618,2 +628,2 @@ | ||
}; | ||
*/ | ||
*/ |
{ | ||
"name": "gohttp", | ||
"version": "3.2.0-beta", | ||
"version": "3.2.0-beta2", | ||
"description": "http client for HTTP/1.1", | ||
@@ -5,0 +5,0 @@ "main": "gohttp.js", |
67394
1119