From 889af3c8537ca24786dfc00d0c9cb02b74b4cd57 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Fri, 28 Mar 2025 12:20:42 -0700 Subject: [PATCH] Revert "fix: tired URL parsing bug" (#77) Reverts microsoft/playwright-mcp#70 I was working on a bigger change and this conflicts. --- src/program.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/program.ts b/src/program.ts index f3fe23d..ed9cf50 100644 --- a/src/program.ts +++ b/src/program.ts @@ -54,9 +54,9 @@ program if (options.port) { const sessions = new Map(); const httpServer = http.createServer(async (req, res) => { - const url = new URL(req.url ?? '', `http://${req.headers.host}`); if (req.method === 'POST') { - const sessionId = url.searchParams.get('sessionId'); + const host = req.headers.host ?? 'http://unknown'; + const sessionId = new URL(host + req.url!).searchParams.get('sessionId'); if (!sessionId) { res.statusCode = 400; res.end('Missing sessionId');