Skip to content

Commit 4ae8460

Browse files
committed
fix(node-http-handler): fix invalid usage of parsed url
1 parent b12dc1d commit 4ae8460

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/node-http-handler/src/node-http-handler.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,18 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
209209
if (request.fragment) {
210210
path += `#${request.fragment}`;
211211
}
212+
213+
let hostname: string;
214+
if (request.hostname.startsWith("[") && request.hostname.endsWith("]")) {
215+
hostname = request.hostname.slice(1, -1);
216+
} else {
217+
hostname = request.hostname;
218+
}
219+
220+
212221
const nodeHttpsOptions: RequestOptions = {
213222
headers: request.headers,
214-
host: request.hostname,
223+
host: hostname,
215224
method: request.method,
216225
path,
217226
port: request.port,

0 commit comments

Comments
 (0)