Skip to content

Content-Length should be set in the request when using reactive WebClient [SPR-16949] #19562

Closed
@spring-projects-issues

Description

@spring-projects-issues

Mirko Adebahr opened SPR-16949 and commented

As of #21431, the content-length header should be set in the request for Mono publishers when using the reactive WebClient. Still, as far as I can see the header is not set in the HTTP request.

This is what I think is the problem:

  1. AbstractClientHttpRequest::doCommit: applyHeaders() is called as commit action -> Headers are applied to httpRequest in ReactorClientHttpRequest
  2. After this, body.doOnNext(data -> headers.setContentLength(data.readableByteCount())) is called (see EncoderHttpMessageWriter::write)

The doOnNext seems to be executed too late to have an effect on the headers in the HTTP request.


Affects: 5.0.7

Issue Links:

Referenced from: commits 280da61, 6189e17, 4a26f93, d1c9401

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions