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: #46989
Backport-PR-URL: #48345
Fixes: #46981
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
aduh95 authored and danielleadams committed Jul 12, 2023
1 parent f495cb6 commit 4784e64
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 4784e64

Please sign in to comment.