chore(fetch): host does not include port (#21845)

This commit is contained in:
Yury Semikhatsky 2023-03-21 13:14:50 -07:00 committed by GitHub
parent 1bbe2b4b6a
commit 1004e762aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -130,7 +130,7 @@ function clientRequestArgsToHostName(options: http.ClientRequestArgs): string {
if (options.hostname)
return options.hostname;
if (options.host)
return options.host.split(':')[0];
return options.host;
throw new Error('Either options.hostname or options.host must be provided');
}

View File

@ -60,3 +60,9 @@ it('https post should work with ignoreHTTPSErrors option', async ({ context, htt
expect(interceptedHostnameLookup).toBe('localhost');
});
it('should work with ip6 and port as the host', async ({ request, server }) => {
const response = await request.get(`http://[::1]:${server.PORT}/simple.json`);
expect(response.url()).toBe(`http://[::1]:${server.PORT}/simple.json`);
expect(response).toBeOK();
});