My REST API return data likes below
[{ "metadata":
{ "type": 1,
"taken_at": "2015-08-25T04:58:04.000Z",
"size": 235315,
"filename": "5787318d0321444d452ec986.jpg" },
"created_at": "2016-07-14T06:46:45.135Z",
"updated_at": "2016-07-14T06:46:45.135Z",
"data": "{base64 encoded data}",
}]
and here is my interceptor
Request.Builder requestBuilder = original.newBuilder()
.header("Accept", "application/json")
.header("Content-Type","application/json; charset=utf-8")
.header("Authorization", token.getTokenType() + " " + token.getAccessToken())
.method(original.method(), original.body());
Request request = requestBuilder.build();
return chain.proceed(request);
Somehow, when response is large (around ~500KB), IOException: unexpected end of stream is thrown in onFailure(). More strangely, the exception is not always being thrown for the same request.
Sometime it succeeds, most of the time not.
I wonder the response's size is the problem here. If it is, could I increase the response size limit?
There is no limit, and Retrofit isn't in control of anything that happens at the HTTP client level.
This seems like https://github.com/square/okhttp/issues/2738.
I also have the same problem did you get answer for this?
Most helpful comment
There is no limit, and Retrofit isn't in control of anything that happens at the HTTP client level.
This seems like https://github.com/square/okhttp/issues/2738.