We use RestTemplate for post request which uses internally SimpleClientHttpRequestFactory to create a http request.
It adds one of the headers ( Either Content-Length or transfer-encoding: chunked) in client request headers list at any time.
I would like to understand more on what conditions it chooses one of the headers?
Is there any way rest template to choose header: content-length always without down grading from spring-web 6.1.6 to 6.0 and without using BufferingClientHttpRequestFactory?
because server i am connecting not supporting header: transfer-encoding: chunked
I know BufferingClientHttpRequestFactory makes rest template to choose Content-Length header always but it has memory resources limitation as full payload to be loaded in memory to find out the size.
Will upgrading spring boot starter 3.3.x help to choose content-length always ?
I am Using spring boot starter : 3.2.5 where spring-web : 6.1.6
Sources
https://github.com/spring-projects/spring-framework/issues/31807
https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#web-applications
Any help is much appreciated.
Thanks