CARD-25, decision D23, GitHub #48. parseQuery took url.split('?')[1], so a second ? ended the query string: /search?q=what?now gave q: 'what'. RFC 3986 §3.4 allows ? inside a query. The query string is now everything after the first? and before #, if one is present.
src/http/router.ts: parseQuery uses indexOf('?') + slice, stopping at #. The fast return for URLs without a query is kept, and so is its measurement note. The comment that deferred this behaviour question is removed (the card asks for that).
Path extraction is unchanged; it already split on the first ?.
CHANGELOG.md: ### Changed entry.
Tests
test/query-string.test.ts covers T1–T4 through parseQuery directly, through app.fetch and through the Node listener (app.listen), plus a fragment case. Before the fix, 7 of these 13 tests failed (T1 and T2 on every path, plus the fragment case).
Frozen router-parity captures: none changed; no capture covers a second ?.
Rebased on origin/develop after #134 and #135 merged.npm audit --audit-level=moderate passes locally on this branch now, and the Bun close-code tests are fixed on develop. Local checks were re-run after the rebase with the same results.
Unsure about
The card's rule says "before #, if present". Node's req.url and a Request URL never carry a fragment, so the # handling only matters for direct callers of the exported parseQuery. I implemented it as the rule says.
Docs follow-up (CARD-12)
Request/params guide (@query): note that ? inside a query value is kept (/search?q=what?now → q: 'what?now').
## What and why
CARD-25, decision D23, GitHub `#48`. `parseQuery` took `url.split('?')[1]`, so a second `?` ended the query string: `/search?q=what?now` gave `q: 'what'`. RFC 3986 §3.4 allows `?` inside a query. The query string is now everything after the **first** `?` and before `#`, if one is present.
- `src/http/router.ts`: `parseQuery` uses `indexOf('?')` + `slice`, stopping at `#`. The fast return for URLs without a query is kept, and so is its measurement note. The comment that deferred this behaviour question is removed (the card asks for that).
- Path extraction is unchanged; it already split on the first `?`.
- `CHANGELOG.md`: `### Changed` entry.
## Tests
`test/query-string.test.ts` covers T1–T4 through `parseQuery` directly, through `app.fetch` and through the Node listener (`app.listen`), plus a fragment case. Before the fix, 7 of these 13 tests failed (T1 and T2 on every path, plus the fragment case).
| Check | Result |
|---|---|
| `npm run lint` | 0 errors (50 existing `no-explicit-any` warnings, unchanged) |
| `npm run format:check` | pass |
| `npm run typecheck` | pass |
| `npm test` | 93 files, 928 tests passed |
| `npm run build` | pass |
| `npm run complexity:check` | every function ≤ 25 |
| `npm run test:deno` | 36 passed, 0 failed |
| `npm run test:bun` | 26 pass, 0 fail |
| `npm run test:edge` | PASS (incl. router parity 1158 matcher + 55 app.fetch cases) |
**Frozen router-parity captures:** none changed; no capture covers a second `?`.
**Rebased on `origin/develop` after #134 and #135 merged.** `npm audit --audit-level=moderate` passes locally on this branch now, and the Bun close-code tests are fixed on develop. Local checks were re-run after the rebase with the same results.
## Unsure about
- The card's rule says "before `#`, if present". Node's `req.url` and a `Request` URL never carry a fragment, so the `#` handling only matters for direct callers of the exported `parseQuery`. I implemented it as the rule says.
## Docs follow-up (CARD-12)
- Request/params guide (`@query`): note that `?` inside a query value is kept (`/search?q=what?now` → `q: 'what?now'`).
parseQuery took `url.split('?')[1]`, so a second `?` ended the query
string and `/search?q=what?now` gave `q: 'what'`. RFC 3986 §3.4 allows
`?` inside a query. The query string is now everything after the first
`?` and before `#`, if one is present. The early return for URLs without
a query is kept, and so is its measurement note. The comment that
deferred this behaviour question is removed because the question is now
decided (D23).
Path extraction already split on the first `?` and is unchanged.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What and why
CARD-25, decision D23, GitHub
#48.parseQuerytookurl.split('?')[1], so a second?ended the query string:/search?q=what?nowgaveq: 'what'. RFC 3986 §3.4 allows?inside a query. The query string is now everything after the first?and before#, if one is present.src/http/router.ts:parseQueryusesindexOf('?')+slice, stopping at#. The fast return for URLs without a query is kept, and so is its measurement note. The comment that deferred this behaviour question is removed (the card asks for that).?.CHANGELOG.md:### Changedentry.Tests
test/query-string.test.tscovers T1–T4 throughparseQuerydirectly, throughapp.fetchand through the Node listener (app.listen), plus a fragment case. Before the fix, 7 of these 13 tests failed (T1 and T2 on every path, plus the fragment case).npm run lintno-explicit-anywarnings, unchanged)npm run format:checknpm run typechecknpm testnpm run buildnpm run complexity:checknpm run test:denonpm run test:bunnpm run test:edgeFrozen router-parity captures: none changed; no capture covers a second
?.Rebased on
origin/developafter #134 and #135 merged.npm audit --audit-level=moderatepasses locally on this branch now, and the Bun close-code tests are fixed on develop. Local checks were re-run after the rebase with the same results.Unsure about
#, if present". Node'sreq.urland aRequestURL never carry a fragment, so the#handling only matters for direct callers of the exportedparseQuery. I implemented it as the rule says.Docs follow-up (CARD-12)
@query): note that?inside a query value is kept (/search?q=what?now→q: 'what?now').2dd0d1f8feto8d7fe1e35a?after the first in the query string (CARD-25, GitHub #48)parseQuery took `url.split('?')[1]`, so a second `?` ended the query string and `/search?q=what?now` gave `q: 'what'`. RFC 3986 §3.4 allows `?` inside a query. The query string is now everything after the first `?` and before `#`, if one is present. The early return for URLs without a query is kept, and so is its measurement note. The comment that deferred this behaviour question is removed because the question is now decided (D23). Path extraction already split on the first `?` and is unchanged. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>8d7fe1e35ato8bf54ec168