Closed
Description
Mirko Adebahr opened SPR-16892 and commented
We're trying to use WebClient
for creating a non-blocking POST request. The request results in a 400 Bad Request due to a missing content-length
header. As the requested endpoint belongs to a 3rd party application, we cannot change that server's behaviour.
In #21085, the EncoderHttpMessageWriter
was enhanced to automatically set the content-length
Header if the provided publisher is a Mono
. Unfortunately, this does not help when using Jackson2JsonEncoder
for encoding as getContentLength
will always return null
.
In my understanding, for MonoJust
s and FluxJust
s it should be possible to determine the content length and set the header value accordingly.
Affects: 5.0.6
Issue Links:
- EncoderHttpMessageWriter never sets Content-Length [SPR-16542] #21085 EncoderHttpMessageWriter never sets Content-Length
- Content-Length should be set in the request when using reactive WebClient [SPR-16949] #19562 Content-Length should be set in the request when using reactive WebClient