Skip to content

Conversation

@densetsuuu
Copy link
Contributor

@densetsuuu densetsuuu commented Jan 29, 2026

Problem

Calling urlFor('route', null, { qs: { var: 'hi' } }) produces /route??var=hi instead of /route?var=hi.

Root cause

buildSearchParams in packages/core/src/client/serializer.ts returned the query string with a leading ?. However, createURL in @adonisjs/http-server
already prepends one, resulting in a double ??.

Fix

Remove the ? prefix from buildSearchParams return value, so it returns a bare query string (foo=bar instead of ?foo=bar). This is consistent with thesearchParamsStringifier contract expected by @adonisjs/http-server.

Changes

  • packages/core/src/client/serializer.ts — remove leading ? from return value
  • packages/core/tests/serializer.spec.ts — update all expectations to match new output
  • packages/core/tests/client_extras.spec.ts — add non-regression test that calls urlFor with qs and asserts no ?? in the resulting URL

Non-regression test

The new test in client_extras.spec.ts exercises the exact bug scenario end-to-end through urlFor. It was verified to fail before the fix and pass after.

@Julien-R44
Copy link
Owner

tié le goat mon sang

@Julien-R44 Julien-R44 merged commit 76c7734 into Julien-R44:next Jan 29, 2026
3 checks passed
@densetsuuu densetsuuu deleted the fix/double-question-mark-query-params branch January 30, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants