question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

withTestApplication sendPipeline interceptors do not work

See original GitHub issue

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.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
cy6erGn0mcommented, Jan 28, 2020

I’m almost ready to make that decision 😃

1reaction
cy6erGn0mcommented, Jan 13, 2020

Something like this

application.intercept(ApplicationCallPipeline.Fallback) {
    if (call.response.status() == null) {
        call.respond(HttpStatusCode.NotFound)
        finish()
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ktor Interceptor Ordering for same Phase and overriding
I see no way to override the merge and delete all but the "last" interceptor for the Phase "Limit". The other "Limit" should...
Read more >
HttpRequestPipeline - ktor
All interceptors accept payload as subject and try to convert it to OutgoingContent. Last phase should proceed with HttpClientCall.
Read more >
Intro to testing Ktor controllers - Kotlin Testing
Let's suppose that we want to dismiss all calls for api/restricted endpoint if they don't have special header, in this case ...
Read more >
Lifecycle - 服务器 - Ktor
You can run a Ktor application in several ways: ... within a web server; As part of a test using withTestApplication from the...
Read more >
[Auth] [Interceptors] Phase Phase('Challenge') was not ...
[Auth] [Interceptors] Phase Phase('Challenge') was not registered for this pipeline. Hi! I want to observe and store/retrieve state parameter in Ktor OAuth.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found