Hi there, I am using Ktor 1.5.0 combined with plat...
# ktor
p
Hi there, I am using Ktor 1.5.0 combined with platform specific httpclients (OkHttp & Ios). I have setup the HttpResponseValidator although whenever I receive an http error like 401, instead of catching a custom throwable I made for this case, I am always getting a NoTransformationFoundException. Have you encountered anything similar?
r
please check this ticket and comments https://youtrack.jetbrains.com/issue/KTOR-1703
p
Thanks, that helped a lot. I set
Copy code
expectSuccess = true
, then I receive a ClientRequestException. Finally I can extract the Http status like this and perform any further actions:
Copy code
val httpStatus = (error as? ResponseException)?.getHttpStatus() ?: 200

fun ResponseException.getHttpStatus(): Int {
    return response.status.value
}
I must say though that the response validator seems a really handy tool I we are awaiting for its issue to be fixed.
m
I totally agree
amazing I got it right by setting expectSuccess=false .... But the issue is clear we send crap to de server and we want to get crap from the server ..... that's it. But we want to know ... what crap is it.