Closed ceremo closed 1 week ago
Thanks for raising this. This has been fixed in #33459 already, but only for the upcoming 6.2 release. We did not apply the fix on the existing maintenance branches because it was too late in the maintenance cycle for such a behavior change.
Luckily the release is scheduled for Thursday and Spring Boot 3.4.0 will follow next week.
Hi,
Since this change, a
RestTemplate
with a custom interceptor that modifies the body content, theContent-Lenght
is not updated, so initial value is sent. TheContent-Length
header sent is resolved from the entity included in the request (ClassicHttpRequest
), finally is added to the final request inorg.apache.hc.core5.http.protocol.RequestContent
. The request entity is previously configured inorg.springframework.http.client.HttpComponentsClientHttpRequest
, this processes the headers discarding theContent-Length
from thehttpRequest
, but in the entity is included, is that correct?Before that change, I did not have to worry about updating the
Content-Length
value, so there is a behaviour difference in the latest versions, is this a bug or do I have to update theContent-Length
header in the same interceptor where is body content modified?Thanks for your time.