Skip to content

Commit

Permalink
perf: remove unnecessary new URL calls (nodejs#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS authored and KhafraDev committed Jun 23, 2022
1 parent 02c87ca commit d89d3ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/fetch/index.js
Expand Up @@ -768,7 +768,7 @@ async function schemeFetch (fetchParams) {
const {
protocol: scheme,
pathname: path
} = new URL(requestCurrentURL(request))
} = requestCurrentURL(request)

// switch on request’s current URL’s scheme, and run the associated steps:
switch (scheme) {
Expand Down
3 changes: 1 addition & 2 deletions lib/fetch/request.js
Expand Up @@ -803,8 +803,7 @@ function makeRequest (init) {
...init,
headersList: init.headersList
? new HeadersList(init.headersList)
: new HeadersList(),
urlList: init.urlList ? [...init.urlList.map((url) => new URL(url))] : []
: new HeadersList()
}
request.url = request.urlList[0]
return request
Expand Down

0 comments on commit d89d3ff

Please sign in to comment.