Closed ddossot closed 10 years ago
not totally sure about return boolean since if you want to filter you might also want to filter say based on some backend database value (say oauth tokens) then you need to be asynchronous...
On the other end can we just make a middleware a la Router
that is instantiated with a filter interface and the just has a method use(Middleware... middlewares)
?
Indeed, creating a middleware that conditionally delegates to another middleware, or list of middlewares, would work too. Thanks for your feedback.
It's currently possible to filter middlewares based on routes:
use(route, middleware)
It would be super powerful to be able to do the same with a more generic
YokeRequestFilter
(withaccept(request) -> boolean
) like this:use(filter, middleware)
.Rationale: being able to use other request properties than path for filtering, like for example the value of the
Accept
header.