fix(trace-viewer): keep searchParams on / redirect (#27956)

Relates to https://github.com/microsoft/playwright/issues/27952.

Might help future users too.
This commit is contained in:
Max Schmitt 2023-11-03 17:38:55 +01:00 committed by GitHub
parent a55fe8fd1f
commit 326c9785b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,9 +119,9 @@ async function startTraceViewerServer(traceUrls: string[], options?: OpenTraceVi
const searchQuery = params.length ? '?' + params.join('&') : '';
const urlPath = `/trace/${app || 'index.html'}${searchQuery}`;
server.routePath('/', (_, response) => {
server.routePath('/', (request, response) => {
response.statusCode = 302;
response.setHeader('Location', urlPath);
response.setHeader('Location', urlPath + request.url!.substring(1));
response.end();
return true;
});