-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.IllegalStateException: closed #3336
Comments
Best guess is that you're reading and closing the response body in your interceptor which means it's not available to consume by the normal Retrofit internals. If you want to read the body in an interceptor and you don't plan on replacing it then it's best to use OkHttp's If it's not this, please isolate the behavior to a small executable sample or failing test so we can debug what's going on. |
Hi @JakeWharton, issue is resolved. Thank you so much for your response, I have shared detail in StackOverflow, with your thanks, so it will be helpful for others. |
- replace `respose.toString()` with `response.peekBody(Long.MAX_VALUE).string()` inspiration: square/retrofit#3336 (comment) fixes: LEARNER-9831
I am using two kind of interceptor, one is HttpLoggingInterceptor and another one is my custom AuthorizationInterceptor
I am using below updated retrofit version library,
below is code
When I try to execute below code, in file named SynchronizationManager.kt, it gives me an error.
My RulesResourcesServices class is here
After debug I found that when below function called, at that time I am getting an exception
I am getting following error
Below is screenshot, in that you can see that, I am getting output of file but don't know why it is throwing an exception.
checked Retrofit's Utils class
https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/Utils.java
Update
Same thing is working fine with enqueue method.
The text was updated successfully, but these errors were encountered: