Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Content-Length if body changed by client interceptor
Prior to this commit, the HTTP interceptor model used for `RestTemplate` and `RestClient` would not update the "Content-Length" request header, even when the request body had been updated by a `ClientHttpRequestInterceptor`. Even though this is the `ClientHttpRequestInterceptor`'s responsibility (along with the content type and encoding changes if needed), this would result in invalid requests. This invalid situation can be detected by `InterceptingClientHttpRequest`. This commit ensures that such situations are detected and fixed automatically by setting the Content-Length header to the actual body size, right before executing the actual request, after all interceptors are done. Closes gh-33459
- Loading branch information