Closed
Description
Rossen Stoyanchev opened SPR-16542 and commented
Currently only ResourceHttpMessageWriter
and FormHttpMessageWriter
set the Content-Length header. For any Encoder
(String, byte[], ByteBuffer, etc) wrapped with EncoderHttpMessageWriter
, there is no mechanism in place to set the Content-Length header, even in cases where a single item is provided synchronously (e.g. WebClient's syncBody
, controller returning a String, etc.).
We should be able to set the content length in cases where the input Publisher is a Mono. That would provide parity with HttpMessageConverter
s, covering all single value cases (synchronous or asynchronous).
Affects: 5.0.4
Issue Links:
- AbstractJackson2Encoder::getContentLength should not return null for MonoJust/FluxJust publisher [SPR-16892] #21431 AbstractJackson2Encoder::getContentLength should not return null for MonoJust/FluxJust publisher
- Remove transfer-encoding check in EncoderHttpMessageWriter and related workaround in ReactorServerHttpResponse [SPR-17393] #21926 Remove transfer-encoding check in EncoderHttpMessageWriter and related workaround in ReactorServerHttpResponse
Referenced from: commits 2781584