Skip to content

Commit eb5e3b3

Browse files
authored
feat(chromium): improve URL handling for WebSocket endpoint retrieval (#36098)
1 parent 14dfb29 commit eb5e3b3

File tree

1 file changed

+4
-1
lines changed
  • packages/playwright-core/src/server/chromium

1 file changed

+4
-1
lines changed

packages/playwright-core/src/server/chromium/chromium.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,10 @@ async function urlToWSEndpoint(progress: Progress, endpointURL: string, headers:
368368
if (endpointURL.startsWith('ws'))
369369
return endpointURL;
370370
progress.log(`<ws preparing> retrieving websocket url from ${endpointURL}`);
371-
const httpURL = endpointURL.endsWith('/') ? `${endpointURL}json/version/` : `${endpointURL}/json/version/`;
371+
const url = new URL(endpointURL);
372+
url.pathname += 'json/version/';
373+
const httpURL = url.toString();
374+
372375
const json = await fetchData({
373376
url: httpURL,
374377
headers,

0 commit comments

Comments
 (0)