Skip to content

fix(validator): preserve repeated query parameters - #652

Open
Dazzanova wants to merge 1 commit into
voidzero-dev:mainfrom
Dazzanova:fix/repeated-query-params
Open

Dazzanova wants to merge 1 commit into
voidzero-dev:mainfrom
Dazzanova:fix/repeated-query-params

Conversation

@Dazzanova

@Dazzanova Dazzanova commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #645 : withValidator({ query }) now preserves repeated query parameters as arrays instead of keeping only the last value.

Changes

  • Use Hono's c.req.queries() to retrieve query parameters, including repeated keys.
  • Normalize single-value parameters to strings and repeated parameters to arrays.
  • Add an integration test covering both single and repeated query parameters.

Expected Behavior

For GET /notes?page=2&tag=work&tag=urgent, the validated query is:

{
  page: '2',
  tag: ['work', 'urgent'],
}

Single-value query parameters retain their existing behavior.

This branch has not been deployed

No deployments
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.

withValidator({ query }) keeps only the last value of a repeated query key

1 participant