Skip to content

Commit

Permalink
url: allow extension of user provided URL objects
Browse files Browse the repository at this point in the history
PR-URL: nodejs#46989
Fixes: nodejs#46981
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
aduh95 authored and anonrig committed Jul 9, 2023
1 parent affc2e0 commit 353bab0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/url.js
Expand Up @@ -1170,9 +1170,9 @@ function urlToHttpOptions(url) {
__proto__: null,
...url, // In case the url object was extended by the user.
protocol: url.protocol,
hostname: url.hostname && StringPrototypeStartsWith(url.hostname, '[') ?
StringPrototypeSlice(url.hostname, 1, -1) :
url.hostname,
hostname: hostname && StringPrototypeStartsWith(hostname, '[') ?
StringPrototypeSlice(hostname, 1, -1) :
hostname,
hash: url.hash,
search: search,
pathname: pathname,
Expand Down

0 comments on commit 353bab0

Please sign in to comment.