Skip to content

Commit 4784e64

Browse files
aduh95danielleadams
authored andcommitted
url: allow extension of user provided URL objects
PR-URL: #46989 Backport-PR-URL: #48345 Fixes: #46981 Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent f495cb6 commit 4784e64

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/url.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,9 +1170,9 @@ function urlToHttpOptions(url) {
11701170
__proto__: null,
11711171
...url, // In case the url object was extended by the user.
11721172
protocol: url.protocol,
1173-
hostname: url.hostname && StringPrototypeStartsWith(url.hostname, '[') ?
1174-
StringPrototypeSlice(url.hostname, 1, -1) :
1175-
url.hostname,
1173+
hostname: hostname && StringPrototypeStartsWith(hostname, '[') ?
1174+
StringPrototypeSlice(hostname, 1, -1) :
1175+
hostname,
11761176
hash: url.hash,
11771177
search: search,
11781178
pathname: pathname,

0 commit comments

Comments
 (0)