fix(launchServer): return precise wsAddress
This commit is contained in:
parent
a7599ad509
commit
c14084be84
|
|
@ -31,5 +31,3 @@ Browser websocket url.
|
||||||
|
|
||||||
Browser websocket endpoint which can be used as an argument to [`method: BrowserType.connect`] to establish connection
|
Browser websocket endpoint which can be used as an argument to [`method: BrowserType.connect`] to establish connection
|
||||||
to the browser.
|
to the browser.
|
||||||
|
|
||||||
Note that if the listen `host` option in `launchServer` options is not specified, localhost will be output anyway, even if the actual listening address is an unspecified address.
|
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,12 @@ export class WSServer {
|
||||||
reject(new Error('Could not bind server socket'));
|
reject(new Error('Could not bind server socket'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const wsEndpoint = typeof address === 'string' ? `${address}${path}` : `ws://${hostname || 'localhost'}:${address.port}${path}`;
|
if (typeof address === 'string') {
|
||||||
resolve(wsEndpoint);
|
resolve(`${address}${path}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const resolvedHost = address.family === 'IPv4' ? address.address : `[${address.address}]`;
|
||||||
|
resolve(`ws://${resolvedHost}:${address.port}${path}`);
|
||||||
}).on('error', reject);
|
}).on('error', reject);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
3
packages/playwright-core/types/types.d.ts
vendored
3
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -17215,9 +17215,6 @@ export interface BrowserServer {
|
||||||
* Browser websocket endpoint which can be used as an argument to
|
* Browser websocket endpoint which can be used as an argument to
|
||||||
* [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect)
|
* [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect)
|
||||||
* to establish connection to the browser.
|
* to establish connection to the browser.
|
||||||
*
|
|
||||||
* Note that if the listen `host` option in `launchServer` options is not specified, localhost will be output anyway,
|
|
||||||
* even if the actual listening address is an unspecified address.
|
|
||||||
*/
|
*/
|
||||||
wsEndpoint(): string;
|
wsEndpoint(): string;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue