Hello all, is it possible to stack filters which a...
# http4k
m
Hello all, is it possible to stack filters which apply to specific routes? For example, could I have a stack of BasicAuth filters, each for a specific route?
d
it's purely function composition, so you can technically do whatever you want. 😉 . There are several options really - you can apply filters individually to each HttpHandler before putting them into the routes block, or just group the routes by which security you want to apply and then compose them. Or you could write a filter which applied another filter depending on the path.
Personally, I'd lean towards the first option (applying the correct filter to the correct route) as it's more explicit
m
Thanks @dave