Skip to content

Commit ccd73d6

Browse files
aduh95anonrig
authored andcommitted
url: allow extension of user provided URL objects
PR-URL: nodejs#46989 Fixes: nodejs#46981 Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent d327cc2 commit ccd73d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/url.js

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

0 commit comments

Comments
 (0)