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 6, 2023
1 parent 422a25b commit 5861a42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,9 +1171,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 5861a42

Please sign in to comment.