Description
Emanuel Seidinger opened SPR-14860 and commented
When configuring the RestTemplateBuilder using the Netty4ClientHttpRequestFactory I get an error message when making PUT or POST requests with the built RestTemplate:
Failed to read HTTP message:... HttpMessageNotReadableException: Required request body is missing
When I use SimpleClientHttpRequestFactory everything works fine.
I use the following Netty dependency:
compile 'io.netty:netty-all:4.1.6.Final'
A sample project illustrating the problem can be found here:
https://github.com/eseidinger/spring-boot-netty-problem
I first thought it's a Spring Boot issue with the TestRestTemplate only, because creating a RestTemplate using its constructor worked. But it turned out that the TestRestTemplate was automatically configured to use the Netty4ClientHttpRequestFactory when it finds Netty on the classpath and configuring the RestTemplate with the Netty4ClientHttpRequestFactory resulted in the same problem. The issue can be found here:
spring-projects/spring-boot#7240
Affects: 4.3.3
Reference URL: spring-projects/spring-boot#7240
Issue Links:
- Netty4ClientHttpRequestFactory buffers (aggregates) all requests/responses [SPR-12631] #17232 Netty4ClientHttpRequestFactory buffers (aggregates) all requests/responses
- Netty4ClientHttpRequestFactory should configure a default SslContext [SPR-14744] #19310 Netty4ClientHttpRequestFactory should configure a default SslContext
- RestTemplate with Netty produces two Content-Length headers [SPR-15241] #19806 RestTemplate with Netty produces two Content-Length headers
- Support for Jetty 9.4 (and 9.3.15+) [SPR-14940] #19507 Support for Jetty 9.4 (and 9.3.15+)
Referenced from: commits ec8391a, 9d37472
2 votes, 7 watchers