Hello all, in the `greetRoute()` example (<https:/...
# http4k
m
Hello all, in the
greetRoute()
example (https://www.http4k.org/guide/reference/contracts/), how would I apply a filter before the
greet(nameFromPath: String)
handler is invoked?
d
you have options. at the lowest level, you can :
Copy code
fun greet(nameFromPath: String): HttpHandler = filter.then { request: Request ->
        val age = ageQuery(request)
        val sentMessage = stringBody(request)

        Response(OK).with(stringBody of "hello $nameFromPath you are $age. You sent $sentMessage")
    } @
m
Thanks @dave