Skip to content

Commit

Permalink
lib/request-browser: minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Dec 16, 2023
1 parent 13d28e5 commit 22e6d65
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/request-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 22e6d65

Please sign in to comment.