options is optional

This commit is contained in:
Simon Knott 2024-11-26 16:43:04 +01:00
parent 50e6658e71
commit e971f39816
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -64,7 +64,7 @@ export class TestProxy {
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.port = '' + port; url.port = '' + 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();
}); });
@ -80,7 +80,7 @@ export class TestProxy {
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.port = '' + port; url.port = '' + 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();
}); });