-
Notifications
You must be signed in to change notification settings - Fork 403
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
Default encoding of Enpoint.outStream[X]
should be JSON array, or the Content Type should be application/json-seq
#3113
Comments
/bounty $125 to make |
💎 $125 bounty • ZIOSteps to solve:
Thank you for contributing to zio/zio-http! Add a bounty • Share on socials
|
/attempt #3113 Implement an encoder with the data interspersed with For the decoder parse the array incrementally, not as a single JSON array Options |
💡 @gregor-rayman submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
@gregor-rayman: You've been awarded a $125 bounty by ZIO! 👉 Complete your Algora onboarding to collect the bounty. |
🎉🎈 @gregor-rayman has been awarded $125! 🎈🎊 |
Is your feature request related to a problem? Please describe.
Conceptually when an endpoint returns a list of X, it is the same as when it returns a ZStream[_, _, X]. Currently the default output encoding for
.out[X]
is an JSON array. For.outStream[X]
it is however a not separated collection of JSONs. TheContent-Type
in the response isapplication/json
, correct one would beapplication/json-seq
.Describe the solution you'd like
Either the data should be returned as a JSON array, so prefixed with
[
, separated by,
and terminated by]
, or theContent-Type
should beapplication/json-seq
. I'd prefer the array, because that makes the change change from.out[List[X]]
to.outStream[X]
an internal change of the server, without the need to change the clients.Describe alternatives you've considered
A viable solution currently (RC10) is to provide custom codes for endpoints with
.outStream[X]
stream outputs.The text was updated successfully, but these errors were encountered: