Hi,
Since this change, a RestTemplate
with a custom interceptor that modifies the body content, the Content-Lenght
is not updated, so initial value is sent.
The Content-Length
header sent is resolved from the entity included in the request (ClassicHttpRequest
), finally is added to the final request in org.apache.hc.core5.http.protocol.RequestContent
. The request entity is previously configured in org.springframework.http.client.HttpComponentsClientHttpRequest
, this processes the headers discarding the Content-Length
from the httpRequest
, 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 the Content-Length
header in the same interceptor where is body content modified?
Thanks for your time.
Comment From: bclozel
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.