mathiasbn
08/29/2017, 8:24 AM@Test
fun testStatusMapping2() {
withTestApplication {
application.routing{
route("/foo") {
install(StatusPages) {
statusFile(HttpStatusCode.NotFound, filePattern = "error#.html")
}
intercept(ApplicationCallPipeline.Call) {
call.respond(HttpStatusCode.NotFound)
}
}
}
handleRequest(HttpMethod.Get, "/foo").let { call ->
assertEquals("<html><body>error 404</body></html>", call.response.content)
}
}
}
It's a copy/paste of testStatusMapping test, but with statuspages installed under a route pipeline
https://github.com/Kotlin/ktor/issues/193