Skip to content

fix: resync RoutePath when middleware rewrites URL.Path - #8

Open
notr3kt wants to merge 1 commit into
madalynerlge2:mainfrom
notr3kt:fix/url-param-after-path-rewrite
Open

fix: resync RoutePath when middleware rewrites URL.Path#8
notr3kt wants to merge 1 commit into
madalynerlge2:mainfrom
notr3kt:fix/url-param-after-path-rewrite

Conversation

@notr3kt

@notr3kt notr3kt commented Jul 30, 2026

Copy link
Copy Markdown

Fix

Middleware path rewrites no longer drop URL params.

In routeHTTP, if r.URL.Path != rctx.RoutePath, we resync RoutePath and clear stale params before matching.

Tests

  • TestMiddlewarePathRewriteURLParams (issue sample)
  • TestNestedWildcardAfterRewrite
  • TestNoRewriteStillWorks
  • go test ./... -race

/claim #1

When middleware mutates r.URL.Path, RouteContext.RoutePath is updated
before match/URLParam so nested routes and {params} stay correct.

Closes madalynerlge2#1
@opirebot

opirebot Bot commented Jul 30, 2026

Copy link
Copy Markdown

😅 Unfortunately there are no rewards left to claim in this issue!

@notr3kt

notr3kt commented Jul 30, 2026

Copy link
Copy Markdown
Author

/claim #1

@opirebot

opirebot Bot commented Jul 30, 2026

Copy link
Copy Markdown

😅 Unfortunately there are no rewards left to claim in this issue!

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.

1 participant