-
Notifications
You must be signed in to change notification settings - Fork 38.5k
WebClient throws "java.lang.IllegalStateException: Only one connection receive subscriber allowed" on Post Method with content-type x-www-form-urlencoded #22284
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
Comments
I had a similar issue while migrating https://github.com/mixitconf/mixit to recent Spring Boot version, I will have a look to see if that's related. |
Hello @awilhelmer This is a known behavior, and we don't want to change it because it would break consistency in many other areas. In this case, what happens is:
Now there are several ways to consider this problem. If the application is mainly a Spring WebFlux application using the annotation model, and sometimes binding form data to annotations and using the hidden method trick for forms sent by browsers, then the If the application is mainly a gateway, then this issue is a duplicate of spring-cloud/spring-cloud-gateway#541. In that case you could disable the The only other alternative would be to disable by default this filter In Spring Boot, but we've decided against that in spring-projects/spring-boot#14520 as this would break user expectations in many other cases and feature parity with Spring MVC. It seems that even on modern browsers/front-end stacks, this is still useful to web applications. I'm closing this as "works as designed", but feel free to continue the discussion here if you've got new ideas to share. Thanks! |
Hello @bclozel , thanks for your fast reply. Indeed Nevertheless, I think the exception is confusing for a framework like Spring. So if a client provides a wrong header it will result in this exception and you don't know exactly what the problem is (e.g. your API want JSON but a client sends x-www-form-urlencoded). You should at least extend the Javadoc at request.getBody() and provide an exact exception for this scenario. IMHO the API is broken if methods only works under certain conditions. |
@awilhelmer I've marked this issue for team attention already - thanks for your comments. |
Additional info from the similar error that occurred while upgrading MiXiT project to latest Boot version: it was as well caused by |
One idea would be to wrap the request in |
@rstoyanchev Please see issue that @violetagg linked, I think this needs to be handled gracefully by framework reactor/reactor-netty#718 |
Affects: Spring Boot v2.1.2
When I create a REST Controller which delegates POST requests to another web service i get the following exception when setting content-type header to x-www-form-urlencoded:
Run the test case to reproduce the error or run application and excecute the following cURL:
curl -X POST "http://localhost:8080/test/post" -H "content-type: application/x-www-form-urlencoded"
Attachment:
one-connection.zip
Similar Issue: #22096
The text was updated successfully, but these errors were encountered: