Skip to content

Unit test using WebTestClient (POST with empty body, check status 400) fails with 2.0.4.RELEASE but ok with 2.0.2.RELEASE #14174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marcpa00 opened this issue Aug 22, 2018 · 4 comments
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@marcpa00
Copy link

Sample project showing the issue available at https://github.com/marcpa00/verify-400-with-empty-body

With Spring Boot 2.0.2.RELEASE, doing a POST with an empty body and asserting the response code is 400 works, changing for Spring Boot 2.0.4.RELEASE, the same test fails.
Currently, this is also using spring rest docs, I will try to remove that from the equation.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 22, 2018
@marcpa00
Copy link
Author

FYI : Removing spring restdocs gives same outcome.

@marcpa00
Copy link
Author

I've simplified as much as I could the code to reproduce the problem : no more lombok, no UUID nor DTO (payload is simply a String), no ExceptionHandler, no boot actuator.
Outcome hasn't changed.
Tell me if there is anything else I can try.

@marcpa00
Copy link
Author

For the record, same results with Spring Boot 2.1.0.M2

@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 27, 2018
@bclozel
Copy link
Member

bclozel commented Aug 27, 2018

Overriding the Spring Framework version to 5.0.7 instead of 5.0.8 works around that problem. This shows that this is likely to be a Spring Framework problem in the first place.

I tracked the issue down to a change in Spring Framework 5.0.8, namely SPR-16949. I've created SPR-17220 to fix that.

In the meantime, you can work around this problem by replacing Mono.empty() with Flux.empty(); the effect is the same but you're not going through the same code path.

I'm marking this issue as invalid as it's a Spring Framework problem, but it doesn't mean your report was not useful, quite the opposite. Thanks for the repro project, as usual they help a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants