diff --git a/lib/browser.js b/lib/browser.js index 15c3a34..100874e 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -212,13 +212,26 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){ } // Request - var req = (this.https ? https : http).request({ + var reqOpts = { method: method , path: path , port: this.host ? this.port : (server && server.__port) , host: this.host , headers: headers - }); + }; + var req; + if (this.https){ + if( options.tlsOpts ){ + ["pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized"].forEach(function(name){ + if( options.tlsOpts[name] !== undefined ){ + reqOpts[name] = options.tlsOpts[name]; + } + }); + } + req = https.request(reqOpts); + }else{ + req = http.request(reqOpts); + } req.on('response', function(res){ var status = res.statusCode , buf = '';