OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.42k stars 1.92k forks source link

Is the response.body().asInputStream loads whole file into memory? #2390

Open huanyk opened 4 months ago

huanyk commented 4 months ago

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;
}