Hello Ktor team! I was hoping I could get your at...
# ktor
h
Hello Ktor team! I was hoping I could get your attention in this post, please. I wonder if you could shed some light on whats going on. https://kotlinlang.slack.com/archives/C9EJFT6DB/p1610747171006700?thread_ts=1610747171.006700&cid=C9EJFT6DB
I’ve solved the issue using
expectSuccess = false
. cc: @christophsturm. (Apologies for mentioning you, but I thought you would like to know how I fixed it.
Copy code
private fun mockHttpErrorResponse(httpStatusCode: HttpStatusCode): HttpResponse {
        val client = HttpClient(MockEngine) {
            expectSuccess = false
            engine {

                addHandler {
                    respondError(httpStatusCode)
                }
            }
        }
        return runBlocking { client.get() }
    }