Skip to content

EncoderHttpMessageWriter never sets Content-Length [SPR-16542] #21085

Closed

Description

@spring-projects-issues

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 HttpMessageConverters, covering all single value cases (synchronous or asynchronous).


Affects: 5.0.4

Issue Links:

Referenced from: commits 2781584

Activity

  1. added
    type: enhancement
    in: web
    on Jan 11, 2019
  2. added this to the 5.0.5 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions