From 195ed4a4bade499094d39e9d14f537298392eace Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Fri, 28 Mar 2025 13:41:08 -0700 Subject: [PATCH] chore: parse search params the usual way (#78) --- src/program.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/program.ts b/src/program.ts index 91d1004..3d05257 100644 --- a/src/program.ts +++ b/src/program.ts @@ -89,8 +89,8 @@ async function startSSEServer(port: number, serverList: ServerList) { const sessions = new Map(); const httpServer = http.createServer(async (req, res) => { if (req.method === 'POST') { - const host = req.headers.host ?? 'http://unknown'; - const sessionId = new URL(host + req.url!).searchParams.get('sessionId'); + const searchParams = new URL(`http://localhost${req.url}`).searchParams; + const sessionId = searchParams.get('sessionId'); if (!sessionId) { res.statusCode = 400; res.end('Missing sessionId');