diff --git a/lib/request-browser.js b/lib/request-browser.js index 8e79100..eda065a 100644 --- a/lib/request-browser.js +++ b/lib/request-browser.js @@ -65,12 +65,15 @@ class RequestOptions { if (options.ssl != null) { assert(typeof options.ssl === 'boolean'); - this.url.protocol = 'https:'; + if (options.ssl) + this.url.protocol = 'https:'; + else + this.url.protocol = 'http:'; } if (options.host != null) { assert(typeof options.host === 'string'); - if (options.host.indexOf('::') !== -1) + if (options.host.indexOf(':') !== -1) this.url.hostname = `[${options.host}]`; else this.url.hostname = options.host;