Hello Guys, I was using `2.0.0-beta-1` version of ...
# ktor
p
Hello Guys, I was using
2.0.0-beta-1
version of Ktor in my KMP project. In this version ktor was throwing an exception whenever server returns
400
. But in latest version of ktor I am not able to get any exception thrown from ktor. Can anyone please help me with this issue? CC @Suresh Maidaragi
p
(I'm assuming you meant
3.0.0-beta-1
or are you actually referring to the 2 year old beta release?)
p
I previously used version
2.0.0-beta-1
of ktor. Recently, I upgraded to version
2.3.4
and since then, I am facing the issue that I described in my earlier message.
h
expecteSuccess=true
? Could you be missing this on your client engine?
p
ah, ok. So what does ktor do instead now? (assuming you're using it as client)
h
Copy code
/**
     * Terminates [HttpClient.receivePipeline] if the status code is not successful (>=300).
     * Learn more from [Response validation](<https://ktor.io/docs/response-validation.html>).
     */
    public var expectSuccess: Boolean = false
p
Yes, I am using it in my KMM project. With compose multiplatform. So in previous version if we call any API and server sends 400 status code then ktor was immedietly throwing some ResponseError and I was able to catch it. But now it doesn't throw any error in case of 400.
p
(And you may as well upgrade to version 2.3.6 - more bugfixes)
The Response Validator mentioned by Helio should work.
😃 1
p
Thanks @Helio and @p-schneider I'll try this and let you know how it goes.
👍 1
👍🏽 1
s
Thank you @Helio @p-schneider it worked
👍 1
👍🏽 1