chore(fetch): host does not include port (#21845)
This commit is contained in:
parent
1bbe2b4b6a
commit
1004e762aa
|
|
@ -130,7 +130,7 @@ function clientRequestArgsToHostName(options: http.ClientRequestArgs): string {
|
||||||
if (options.hostname)
|
if (options.hostname)
|
||||||
return options.hostname;
|
return options.hostname;
|
||||||
if (options.host)
|
if (options.host)
|
||||||
return options.host.split(':')[0];
|
return options.host;
|
||||||
throw new Error('Either options.hostname or options.host must be provided');
|
throw new Error('Either options.hostname or options.host must be provided');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,3 +60,9 @@ it('https post should work with ignoreHTTPSErrors option', async ({ context, htt
|
||||||
expect(interceptedHostnameLookup).toBe('localhost');
|
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();
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue