You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our GraphQL endpoint requires OAuth authentication. When we use the apollo client to hit our endpoint and our endpoint returns a status code of 401, the apollo client throws an HttpException with a okhttp3.Response object. The problem is, before the exception is thrown, the Response is closed. This means when we try to read the body of the Response when we try to handle the exception, it is blank.
This is from ApolloParseInterceptor#parse which is where the premature closure of the response happens:
A solution to this could be to not to add a Response to the exception. We can instead create an immutable object, say NetworkResponse that has a responseBody and responseCode that we can add to the exception.
The text was updated successfully, but these errors were encountered:
Looking at Retrofits usage of HttpException it seems like they don't close the response on error. Also I like the idea of adding a statusCode and message directly to the exception, assuming message is the body of the response.
Our GraphQL endpoint requires OAuth authentication. When we use the apollo client to hit our endpoint and our endpoint returns a status code of
401
, the apollo client throws anHttpException
with aokhttp3.Response
object. The problem is, before the exception is thrown, theResponse
is closed. This means when we try to read the body of theResponse
when we try to handle the exception, it is blank.This is from
ApolloParseInterceptor#parse
which is where the premature closure of the response happens:A solution to this could be to not to add a
Response
to the exception. We can instead create an immutable object, sayNetworkResponse
that has aresponseBody
andresponseCode
that we can add to the exception.The text was updated successfully, but these errors were encountered: