switch back to ips

This commit is contained in:
Simon Knott 2024-11-29 15:28:18 +01:00
parent 0fffa086b5
commit 62c5fb29d1
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -63,7 +63,7 @@ export class TestProxy {
this._prependHandler('request', (req: IncomingMessage) => { this._prependHandler('request', (req: IncomingMessage) => {
this.requestUrls.push(req.url); this.requestUrls.push(req.url);
const url = new URL(req.url, `http://${req.headers.host}`); const url = new URL(req.url, `http://${req.headers.host}`);
url.host = `localhost:${port}`; url.host = `127.0.0.1:${port}`;
if (options?.prefix) if (options?.prefix)
url.pathname = url.pathname.replace(options.prefix, ''); url.pathname = url.pathname.replace(options.prefix, '');
req.url = url.toString(); req.url = url.toString();
@ -74,12 +74,12 @@ export class TestProxy {
if (kConnectHostsToIgnore.has(req.url)) if (kConnectHostsToIgnore.has(req.url))
return; return;
this.connectHosts.push(req.url); this.connectHosts.push(req.url);
req.url = `localhost:${port}`; req.url = `127.0.0.1:${port}`;
}); });
this._prependHandler('upgrade', (req: IncomingMessage) => { this._prependHandler('upgrade', (req: IncomingMessage) => {
this.wsUrls.push(req.url); this.wsUrls.push(req.url);
const url = new URL(req.url, `http://${req.headers.host}`); const url = new URL(req.url, `http://${req.headers.host}`);
url.host = `localhost:${port}`; url.host = `127.0.0.1:${port}`;
if (options?.prefix) if (options?.prefix)
url.pathname = url.pathname.replace(options.prefix, ''); url.pathname = url.pathname.replace(options.prefix, '');
req.url = url.toString(); req.url = url.toString();