wrap-route doesn't work for multiple routes
Opened this issue · 1 comments
I was experimenting with wrap-route because I have some middleware that I'd like to apply to two routes.
If I did something like the following:
(wrap-route [:post "/foo"] some-middleware)
it seems to work fine. However, if I do
(wrap-route [:post "/foo"] some-middleware)
(wrap-route [:post "/bar"] some-middleware)
then I get a 404 when I post to /foo
.
Seems like wrap-route should be able to apply middleware to several routes at once (otherwise we're calling the same middleware function several times for no apparent reason) and several pieces of middleware at once. But that's probably a different issue entirely.
@ibdknox Thoughts? This seems like a pretty big issue. :(
I think this is the same issue that was mentioned on the list a while back. Basically we need to change Noir's internal storage of routes to wait until the packing phase before they are turned into compojure routes. This way we could ensure that wrap-route wraps inside of the url-check by wrapping before it goes to compojure's GET/POST/etc.