Skip to content
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

Empty streamed bodies are ignored #8180

Open
gmethvin opened this issue Jan 22, 2018 · 1 comment
Open

Empty streamed bodies are ignored #8180

gmethvin opened this issue Jan 22, 2018 · 1 comment

Comments

@gmethvin
Copy link
Member

gmethvin commented Jan 22, 2018

Right now the Akka HTTP server ignores empty streamed bodies: https://github.com/playframework/playframework/blob/2.6.x/framework/src/play-akka-http-server/src/main/scala/play/core/server/akkahttp/AkkaModelConversion.scala#L282

I think this is probably the wrong thing to do, since the Source is not just data, but also can include processing steps like a watchTermination after the stream is finished. Some users might attempt to use watchTermination or similar, only to find that their source is silently ignored. Akka HTTP handles this case by throwing an exception for empty streamed bodies.

I think we could just handle empty streamed bodies by consuming the body, and simply document that you probably don't want to have a streamed empty body, since that adds extra stream materialization overhead for no reason. This seems like the least surprising behavior. For strict bodies we can keep the current code.

@cchantep
Copy link
Member

Probable related to #6750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants