With Apollo Kotlin 3 the ApolloHttpException there is no rawResponse() method anymore and the body property is always null.
Is there a way to get the error body?
With Apollo Kotlin 3 the ApolloHttpException there is no rawResponse() method anymore and the body property is always null.
Is there a way to get the error body?
As stated in the documentation, the HTTP error body, by default, is always null. You can opt-in
exposeHttpErrorBodyinHttpNetworkTransportif you need it. If you're doing this, you must callBufferedSource.closeonbodyto avoid sockets and other resources leaking.To do this, when you are creating the Apollo client, you have to set
.httpExposeErrorBody()totrue:If you're setting it to
true, you must catchApolloHttpExceptionand close the body explicitly to avoid sockets and other resources leaking.