Rasmus
01/30/2023, 12:59 PM/status
, this request can return 500 with a body that gives details. I also have a StatusPages that listens to all generic 500 errors with respondText.
The problem is that the StatusPages overrides the response body on my /status
request. Is there a way to check if there already is a response body in my StatusPages or something?Aleksei Tirman [JB]
01/30/2023, 3:44 PMcontent
property within a status handler. Here is an example:
install(StatusPages) {
status(HttpStatusCode.InternalServerError) { code ->
if (content is HttpStatusCodeContent) {
call.respondText(status = HttpStatusCode.InternalServerError) { "Error" }
}
}
}
routing {
get("/status") {
call.respondText(status = HttpStatusCode.InternalServerError) { "Status" }
}
get("/") {
call.respond(HttpStatusCode.InternalServerError)
}
}