Reputation: 7517
The app is making a request to an endpoint which is sending back a json string containing data fetched from the database. This data could sometimes get pretty huge, as big as 4mb, the default Transfer-Encoding for the server is chunked so when the data is big enough it splits it into chunks and sends it to the app. The problem is Retrofit doesn't seem to be handling that out of the box and crashes with an EOF error. How can this i let Retrofit or rather OkHttp know that the response could be chunked?
Upvotes: 5
Views: 2090
Reputation: 4838
I have the same problem with an Android Application. After investigations, I found that it is not a code problem. It is my development environment that has some problems!!! My working PC is behind a reverse proxy that probably breaks HTTP calls from my Android emulator.
I ran the same code from another PC like JUnit and on an Android emulator and it works like a charm!
My suggestion is to try to execute the same code in a different environment... JUnit, real device, another PC.
Check my question and my answer about it. You will find a link to the source code.
My question about transfer encoding chunked
Hope it helps you.
Upvotes: 2