Revert "fix: tired URL parsing bug" (#77)

Reverts microsoft/playwright-mcp#70

I was working on a bigger change and this conflicts.
This commit is contained in:
Pavel Feldman 2025-03-28 12:20:42 -07:00 committed by GitHub
parent edac6da891
commit 889af3c853
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,9 +54,9 @@ program
if (options.port) {
const sessions = new Map<string, SSEServerTransport>();
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');