I'm using Volley to make a server call, which can in some cases return a large response - a few megabytes JSON.
When the server response is more "normal" size, everything works, but with a large payload Volley throws a
NetworkError without any details attached and logs a weird message -
BasicNetwork.performRequest: Unexpected response code 200.
I'm pretty sure the issue is with response size, so my question is whether there a known limit for HTTP request/response size in Android/Volley, or a setting to change it. I know some HTTP libraries have it.
I know the server is fine as there are other clients using the same server endpoint in the same way.
I started debugging inside the library code and found that the response code is indeed
200 and the correct data is being received. The request content is being copied from response stream in chunks, but at some point something goes wrong in the copying.
This is the closest I could get to the original exception. Apparently, a
java.net.ProtocolException is getting thrown sometime during the while loop at first breakpoint shown on the picture. You can also see the actual JSON content is there.
Then this exception gets handled and re-thrown a couple more times: