From a5bc2efc180eb85995435ad2499cb0730e919e07 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Mon, 24 Jan 2022 12:41:27 -0800 Subject: [PATCH] chore: followRedirects in PlaywrightClient (#11599) --- packages/playwright-core/src/remote/playwrightClient.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/playwright-core/src/remote/playwrightClient.ts b/packages/playwright-core/src/remote/playwrightClient.ts index 2b827d70d8..da2c5a4728 100644 --- a/packages/playwright-core/src/remote/playwrightClient.ts +++ b/packages/playwright-core/src/remote/playwrightClient.ts @@ -21,7 +21,8 @@ import { makeWaitForNextTask } from '../utils/utils'; export type PlaywrightClientConnectOptions = { wsEndpoint: string; - timeout?: number + timeout?: number; + followRedirects?: boolean; }; export class PlaywrightClient { @@ -30,10 +31,10 @@ export class PlaywrightClient { private _closePromise: Promise; static async connect(options: PlaywrightClientConnectOptions): Promise { - const { wsEndpoint, timeout = 30000 } = options; + const { wsEndpoint, timeout = 30000, followRedirects = true } = options; const connection = new Connection(); connection.markAsRemote(); - const ws = new WebSocket(wsEndpoint); + const ws = new WebSocket(wsEndpoint, { followRedirects }); const waitForNextTask = makeWaitForNextTask(); connection.onmessage = message => { if (ws.readyState === 2 /** CLOSING */ || ws.readyState === 3 /** CLOSED */)