Content-Length
header is not updated when body is modified using ClientHttpRequestInterceptor
#33872
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: duplicate
A duplicate of another issue
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.The
Content-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.
The text was updated successfully, but these errors were encountered: