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
Spring MVC @ResponseBody handling of Flux<?> inconsistent when type of result is unknown [SPR-15456] #20017
Comments
Dave Syer commented Here's another inconsistency (not sure if related). These two methods should be identical as far as HTTP request-response goes:
But the |
Rossen Stoyanchev commented hi Dave, thanks for the report. Spring MVC I presume? And with Given The second issue is that There is an inherent ambiguity whether I will look into the ResponseEntity issue separately. I suspect that's a related but different issue. |
Rossen Stoyanchev commented I've created #20024 to fix a related issue with |
Rossen Stoyanchev commented For the |
Dave Syer commented
Yes. I would argue that is more intuitive. If I could try that out in a snapshot it would be awesome. Does it create a problem for WebFlux when the Flux is potentially unbounded? I would argue that the content negotiation should explicitly require the client to ask for an unbounded media type (e.g. EVENT_STREAM) or else you would expect to get an array still. |
Dave Syer commented
I guess that seems inconsistent to me. I wouldn't mind if that was the behaviour for |
Rossen Stoyanchev commented A snapshot is ready with Spring MVC fixes for If a Flux is unbounded the controller method should be marked accordingly (e.g. with produces="text/event-stream") or otherwise it would be an issue since we assume collection semantics for the Flux by default. Regarding
No matter what we decide to do, there will be some inconsistency depending on your perspective and use case. So I would weigh the use cases and I'd argue that rendering |
Dave Syer commented I know that |
Rossen Stoyanchev commented After consulting others on the team we'll go with treating |
Dave Syer opened SPR-15456 and commented
I would expect this:
to produce an identical result to this:
But it doesn't (the former is "null" and the latter is "[]"). I guess maybe the "null" is a bug?
If the
Flux
is not empty, then both signatures should also probably produce the same result, but doesn't (the strings get concatented and the objects get converted)? Or maybe I'm missing something.Affects: 5.0 RC1
Issue Links:
Referenced from: commits abe3cfd, d3b178a, a936984
The text was updated successfully, but these errors were encountered: