You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Content-Length should be set in the request when using reactive WebClient [SPR-16949] #19562
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:
AbstractClientHttpRequest::doCommit: applyHeaders() is called as commit action -> Headers are applied to httpRequest in ReactorClientHttpRequest
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.
please correct me if I'm wrong, but if you're referring to RequestMappingMessageConversionIntegrationTests, as far as I can see all tests check the content-length header on the HTTP response. #21431 as well as the present issue was/is about the header not being set in the outgoing HTTP request.
I understand that an application for reproduction of this issue would be helpful, but we're talking about a client/server scenario. Maybe it would be sufficient if someone familiar with webflux could take a look and confirm the problem?
This is now fixed in 5.0.x and master (5.1.x) - new SNAPSHOT builds should be available shortly if you'd like to test it against your project before the next releases.
Mirko Adebahr, please give this a try against a recent snapshot: ideally 5.0.8.BUILD-SNAPSHOT, available via Maven from https://repo.spring.io/snapshot... We'll release 5.0.8 in about three weeks, and it'd be great to know upfront whether it works for you now...
Activity
spring-projects-issues commentedon Jun 18, 2018
Brian Clozel commented
Hi Mirko Adebahr,
As of #21431, we've got integration tests covering this use case (see the changes attached to the commit fixing that issue).
Could you provide us with a small application that reproduces this issue?
Thanks,
spring-projects-issues commentedon Jun 18, 2018
Mirko Adebahr commented
Hi Brian,
please correct me if I'm wrong, but if you're referring to
RequestMappingMessageConversionIntegrationTests, as far as I can see all tests check thecontent-lengthheader on the HTTP response. #21431 as well as the present issue was/is about the header not being set in the outgoing HTTP request.I understand that an application for reproduction of this issue would be helpful, but we're talking about a client/server scenario. Maybe it would be sufficient if someone familiar with webflux could take a look and confirm the problem?
spring-projects-issues commentedon Jun 19, 2018
Brian Clozel commented
Mirko Adebahr,
This is now fixed in 5.0.x and master (5.1.x) - new SNAPSHOT builds should be available shortly if you'd like to test it against your project before the next releases.
Thanks!
spring-projects-issues commentedon Jul 2, 2018
Juergen Hoeller commented
Mirko Adebahr, please give this a try against a recent snapshot: ideally
5.0.8.BUILD-SNAPSHOT, available via Maven fromhttps://repo.spring.io/snapshot... We'll release 5.0.8 in about three weeks, and it'd be great to know upfront whether it works for you now...spring-projects-issues commentedon Jul 2, 2018
Mirko Adebahr commented
OK, I'll try to test it until Wednesday.
spring-projects-issues commentedon Jul 4, 2018
Mirko Adebahr commented
It's working, we're looking forward for the next release. Thanks!
spring-projects-issues commentedon Jul 4, 2018
Brian Clozel commented
Thanks a lot for checking Mirko Adebahr, this is helping a lot.