Hi, I have a RoutingHttpHandler (a group of routes...
# http4k
a
Hi, I have a RoutingHttpHandler (a group of routes), is there a way to define a response header just once instead of adding to each route individually (i.e.
.with(CONTENT_TYPE of TEXT_HTML)
or similar)? Must be an easy way but I'm missing it. Thanks!
Filters!
Copy code
val contentTypeHTMLFilter : Filter = Filter { handler ->
    { handler(it).with(CONTENT_TYPE of TEXT_HTML) }
}
then add to the Routes:
Copy code
.withFilter(contentTypeHTMLFilter)
d
👍