Skip to content

fix: preserve query string when stripping prefix from req.url#251

Closed
mcollina wants to merge 1 commit intomainfrom
fix/preserve-query-string-with-prefix
Closed

fix: preserve query string when stripping prefix from req.url#251
mcollina wants to merge 1 commit intomainfrom
fix/preserve-query-string-with-prefix

Conversation

@mcollina
Copy link
Copy Markdown
Member

Summary

  • Fix regression introduced in v9.2.0 where app.use('/prefix', fn) strips the query string from req.url before it reaches the middleware
  • The root cause was normalizePathForMatching() being applied to the full URL including the query string — FindMyWay.sanitizeUrlPath() strips query parameters as part of path sanitization
  • Now the query string is extracted before normalization and re-appended afterward

Closes #248

Test plan

  • Added test req.url stripping preserves query string covering multiple query strings, single query param, and no query param
  • All 76 existing tests pass
  • 100% code coverage maintained

🤖 Generated with Claude Code

normalizePathForMatching() was applied to the full URL including the
query string, but FindMyWay.sanitizeUrlPath() strips query parameters
as part of path sanitization. Now the query string is extracted before
normalization and re-appended afterward.

Closes #248

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mcollina mcollina closed this Feb 28, 2026
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.

app.use('/prefix', fn) strips query strings from req.url since v9.2.0

1 participant