mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: followRedirects in PlaywrightClient (#11599)
This commit is contained in:
parent
136fab7041
commit
a5bc2efc18
@ -21,7 +21,8 @@ import { makeWaitForNextTask } from '../utils/utils';
|
|||||||
|
|
||||||
export type PlaywrightClientConnectOptions = {
|
export type PlaywrightClientConnectOptions = {
|
||||||
wsEndpoint: string;
|
wsEndpoint: string;
|
||||||
timeout?: number
|
timeout?: number;
|
||||||
|
followRedirects?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class PlaywrightClient {
|
export class PlaywrightClient {
|
||||||
@ -30,10 +31,10 @@ export class PlaywrightClient {
|
|||||||
private _closePromise: Promise<void>;
|
private _closePromise: Promise<void>;
|
||||||
|
|
||||||
static async connect(options: PlaywrightClientConnectOptions): Promise<PlaywrightClient> {
|
static async connect(options: PlaywrightClientConnectOptions): Promise<PlaywrightClient> {
|
||||||
const { wsEndpoint, timeout = 30000 } = options;
|
const { wsEndpoint, timeout = 30000, followRedirects = true } = options;
|
||||||
const connection = new Connection();
|
const connection = new Connection();
|
||||||
connection.markAsRemote();
|
connection.markAsRemote();
|
||||||
const ws = new WebSocket(wsEndpoint);
|
const ws = new WebSocket(wsEndpoint, { followRedirects });
|
||||||
const waitForNextTask = makeWaitForNextTask();
|
const waitForNextTask = makeWaitForNextTask();
|
||||||
connection.onmessage = message => {
|
connection.onmessage = message => {
|
||||||
if (ws.readyState === 2 /** CLOSING */ || ws.readyState === 3 /** CLOSED */)
|
if (ws.readyState === 2 /** CLOSING */ || ws.readyState === 3 /** CLOSED */)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user