Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 6ee092f

Browse files
authored
Merge pull request #107 from lukastaegert/fix-search-param-handling
Fix query param handling
2 parents ac70004 + 297f427 commit 6ee092f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/runtime/index.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ function select_route(url: URL): Target {
2828
const params = route.params(match);
2929

3030
const query: Record<string, string | true> = {};
31-
for (const [key, value] of url.searchParams) query[key] = value || true;
32-
31+
if (url.search.length > 0) {
32+
url.search.slice(1).split('&').forEach(searchParam => {
33+
const [, key, value] = /([^=]+)=(.*)/.exec(searchParam);
34+
query[key] = value || true;
35+
})
36+
}
3337
return { url, route, data: { params, query } };
3438
}
3539
}

0 commit comments

Comments
 (0)