ktor: withTestApplication sendPipeline interceptors do not work

Ktor Version and Engine Used (client or server and name) 1.2.6, 1.3.0-rc2

Describe the bug Any sendPipeline interceptor installed does not get called when testing using withTestApplication.

To Reproduce Steps to reproduce the behavior: Install a sendPipeline interceptor an try to use it with a handleRequest. The interception lambda will not be called.

Expected behavior The interception lambda to be called.

You can check out the test code here in this feature of mine where I’m having the issue. A run of the tests is also available here on TravisCI and the corresponding build scan here.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

I’m almost ready to make that decision 😃

Something like this

application.intercept(ApplicationCallPipeline.Fallback) {
    if (call.response.status() == null) {
        call.respond(HttpStatusCode.NotFound)
        finish()
    }
}