Skip to content

Commit a8337f0

Browse files
committed
Refactor URL handling in Request class to use URL constructor for better clarity
1 parent 0874d45 commit a8337f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/node/NodeHttpStack.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ class Request implements HttpRequest {
8888
}
8989

9090
return new Promise((resolve, reject) => {
91+
const parsedUrl = new URL(this._url)
9192
const options = {
92-
...new URL(this._url),
93+
protocol: parsedUrl.protocol,
94+
hostname: parsedUrl.hostname,
95+
port: parsedUrl.port,
96+
path: parsedUrl.pathname + parsedUrl.search,
9397
...this._requestOptions,
9498

9599
method: this._method,

0 commit comments

Comments
 (0)