Closed
Description
bademus opened SPR-16445 and commented
It seems the bug was introduced in #16633
org.springframework.http.converter.ResourceHttpMessageConverter#getContentLength
// Don't try to determine contentLength on InputStreamResource - cannot be read afterwards...
// Note: custom InputStreamResource subclasses could provide a pre-calculated content length!
if (InputStreamResource.class == resource.getClass()) {
return null;
}
In fact default behavior of InputStreamResource is not the same as for its children.
Affects: 4.3.14
Issue Links:
- RestTemplate with InputStreamResource does not work if Content-Length is not set [SPR-12017] #16633 RestTemplate with InputStreamResource does not work if Content-Length is not set
- resttemplate multipart post with InputStreamResource not working [SPR-13571] #18147 resttemplate multipart post with InputStreamResource not working