https://kotlinlang.org logo
#ktor
Title
# ktor
a

Andrew Reed

03/11/2022, 11:42 AM
Hi all, im using ktor 2.0.0-eap-317 (the only version that seems to work properly with HttpCache for ios and android). I have some unit tests from previous version of ktor 1.6.6, where i check for request exceptions around 404, 308, etc. But those tests now fail
Copy code
but was io.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class com.a.mp.networking.TestData
So sending a request asking for a json object response but then i tell my test engine client to respond with a 404 error, but instead it seems to be trying to serialise the 404 error.
With v2.0.0, the
expectSuccess
property used for response validation is set to
false
by default. This requires the following changes in your code:
• To enable default validation and throw exceptions for non-2xx responses, set the
expectSuccess
property to
true
.
👍 2
a

Andrew Reed

03/11/2022, 11:44 AM
ah thanks
Im not sure if this is a bug or not, but when responding in my Test ktor engine a respondRedirect, the code throws an exception trying to transform the response.
s

Sam

03/11/2022, 1:41 PM
Are you expecting it to try and follow the redirect instead? I think there might be an extra plugin/setting to enable for that.
a

Andrew Reed

03/11/2022, 1:43 PM
i would expect it to throw an exception - fall into the HttpResponseValidator
Copy code
handleResponseException
3 Views