chi
chi copied to clipboard
Make CleanPath middleware work with other routers
The rctx is not checked and could be nil if the function isn't used with a chi.Router. It ends up in a panic.
Additional point: the cleaning only happens in the rctx.RoutePath is an empty string. If a function like GetHead ¶ is called before it won't clean the path.
in #787 @romain-tadiello says
Additional point: the cleaning only happens in the rctx.RoutePath is an empty string. If a function like GetHead ¶ is called before it won't clean the path.
I'm not sure but this might be relevant to why he moved the path.Clean() out of the conditional.
Apologies if that's not relevant. I literally just started using chi today.