chi icon indicating copy to clipboard operation
chi copied to clipboard

Make CleanPath middleware work with other routers

Open romain-tadiello opened this issue 2 years ago • 1 comments

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.

romain-tadiello avatar Jan 27 '23 13:01 romain-tadiello

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.

gangelop avatar Mar 08 '24 00:03 gangelop