Hello guys, what is the best way to validate heade...
# ktor
b
Hello guys, what is the best way to validate headers for all requests and returning a customer response?
one way could be to
createApplicationPlugin
but in that case we can only throw exception instead of returning body
Copy code
val HeaderValidatorPlugin = createApplicationPlugin("HeaderValidatorPlugin") {
    on(CallSetup) { call ->
        if (!call.request.headers.contains("X-Customer-Header")) {
            throw BadRequestException("Required header is missing")
        }
a
What prevents sending the response with the
ApplicationCall.respond
method?