Ulrich Winter
12/07/2023, 7:50 AMon(ResponseBodyReadyForSend) hook.
I can get it from call.response.status() in most cases - but not, when authentication has failed.
In that case, I get a null result. The actual 401 status code seems to be generated somewhere later in the plugin chain.
My custom plugin is installed after the Authentication plugin.
How can I retrieve the real status code which is sent to the client within my custom plugin?Aleksei Tirman [JB]
12/07/2023, 8:42 AMResponseSent hook to observe the response status:
val plugin = createApplicationPlugin("plugin") {
on(ResponseSent) { call ->
println("Intercepted status: ${call.response.status()}")
}
}Ulrich Winter
12/07/2023, 8:44 AMAleksei Tirman [JB]
12/07/2023, 8:45 AMAuthenticationHook hookAleksei Tirman [JB]
12/07/2023, 8:48 AMon(ResponseBodyReadyForSend) { call, content ->
if (content is UnauthorizedResponse) {
println(content.status)
}
}Ulrich Winter
12/07/2023, 8:52 AM