`ResponseException` has an `HttpResponse` on it, b...
# ktor
e
ResponseException
has an
HttpResponse
on it, but it looks like by the time I
catch
that exception, the response has already been consumed. I want to parse the json on the response, what’s the best way to do that?
looks like maybe I need to install my own `HttpResponseValidator`…the default one consumes the response body…but then doesn’t set that string on the
ResponseException
😭
r
how do you try to read the response body?
exception.response.receive<Type>()
should work
e
exception.response.content.readEntireUTF8()
the response has already been read by the point i get that exception, so it returns empty string
r
please use
exception.response.receive<String>()
.
content
can be consumed only once, indeed
e
i think because
addDefaultResponseValidation
does its own
exceptionResponse.readText()
ah cool, will try that, tx
yeaahhhhh that did it, thanks @Rustam Siniukov!
👍 1