Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
WebClient throws "Only one connection receive subscriber allowed" when response has content but no Content-Type header [SPR-17482] #22014
I stumbled upon this issue while executing a uncommon outbound API.
Refer the test case at which simulates the issue. https://github.com/nischit7/my-exp-webflux-stream/blob/master/src/test/java/com/example/spring/stream/controller/MoreThanOnSubscriberTest.java
In essence, I am bringing up a mock server which is supposed to return NO media type header. I know for an API, NO response header doesnt seem right. For the moment, pls assume its a negative test case.
On running that test, I get an error -
Note the line number 69 in that test class. I have intentionally commented it. Now uncomment the line and re-rerun the test case. This time, it should be successful. Comment that line again.
Now another interesting thing to note. When you change the version of spring-webflux to 5.0.10.RELEASE, you should see it successful. Change the version of spring-webflix to 5.1.1.RELEASE, it will fail. So obviously something has changed. I do see spring finds no content-type response header and defaults it to octet stream. After which I have not digged further, why it fails.
Affects: 5.1 GA
Referenced from: commits a5339d7
Rossen Stoyanchev commented
This is related to the change for #21592 to consume and release the response content in case of