Skip to content

Use RoutePath in URLFormat middleware#718

Merged
pkieltyka merged 1 commit intogo-chi:masterfrom
shift72:master
Oct 27, 2022
Merged

Use RoutePath in URLFormat middleware#718
pkieltyka merged 1 commit intogo-chi:masterfrom
shift72:master

Conversation

@Kazetsukai
Copy link
Contributor

Currently the URLFormat middleware is resetting the RoutePath to the full URL when used in a sub-router. This change makes it look at the RoutePath, if it exists, and uses that instead of the full URL.

@Kazetsukai
Copy link
Contributor Author

Without this, sub routers break when adding URLFormat middleware. A possible workaround would be to just always use URLFormat at the top level router before any RoutePath is set, but being able to apply this middleware only to a subset of routes is nice.

@pkieltyka pkieltyka merged commit 0fe6bf1 into go-chi:master Oct 27, 2022
ProjectMutilation added a commit to ProjectMutilation/chi that referenced this pull request Jul 9, 2025
Fixes: 0fe6bf1 ("Use RoutePath in URLFormat middleware (go-chi#718)")
Found by PostgresPro with Svace Static Analyzer
Signed-off-by: Maksim Korotkov <[email protected]>
ProjectMutilation added a commit to ProjectMutilation/chi that referenced this pull request Jul 9, 2025
Fixes: 0fe6bf1 ("Use RoutePath in URLFormat middleware (go-chi#718)")
Found by PostgresPro with Svace Static Analyzer
Signed-off-by: Maksim Korotkov <[email protected]>
ProjectMutilation added a commit to ProjectMutilation/chi that referenced this pull request Jul 17, 2025
Fixes: 0fe6bf1 ("Use RoutePath in URLFormat middleware (go-chi#718)")
Found by PostgresPro with Svace Static Analyzer
Signed-off-by: Maksim Korotkov <[email protected]>
VojtechVitek pushed a commit that referenced this pull request Aug 15, 2025
Fixes: 0fe6bf1 ("Use RoutePath in URLFormat middleware (#718)")
Found by PostgresPro with Svace Static Analyzer

Signed-off-by: Maksim Korotkov <[email protected]>
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