Is the response.body().asInputStream loads whole file into memory?
I encountered an Out of Memory (OOM) error when using the response as a receiver while attempting to download a 6GB file. Upon investigation, I discovered that Feign doesn't seem to support downloading large files as inputstream.
final boolean shouldDisconnectResponseBody = response.body() != null
&& response.body().length() != null
&& response.body().length() <= MAX_RESPONSE_BUFFER_SIZE;
if (!shouldDisconnectResponseBody) {
return response;
}
Yes, that will happen with larger files when the return type of the proxied method is Response. This is so we can provide a complete object back to the caller. We do support large responses, by inspecting the Response Content-Length header. If it is larger than 8K, we do not load the data into memory.
If you are seeing the entire body being loaded into memory, check the Response headers to see what is being set and let us know.
Logger may read full response body into memory if your log level is HEADERS or FULL https://github.com/OpenFeign/feign/blob/a695cbaebb0fb71005020e3f037988bb3ac22f76/core/src/main/java/feign/Logger.java#L129