chi
chi copied to clipboard
Expose FindRoute on Mux to enable access to it in custom middleware
We are building a custom middleware which needs to know the route that matched the current request path. Unfortunately, the only available option Match
just returns a yay or nay. Since this method has access to the actual route that matches, can we add a FindRoute
on Mux
that will delegate the actual work to tree.FindRoute
?
Is there an alternate way to determine the route that matches the current http request path in a custom middleware?
I need to do the same thing. I cannot see a workaround other than re-implementing FindRoute with the input of mux.Routes()
. I'm happy to raise a PR for this if the maintainers are open to it.
Also looking for the same feature.