-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add JsonLines
extractor and response
#1093
Conversation
Just a small comment about the naming. |
@FSMaxB Good point! I had only heard of "newline delimited json" but seeing as json lines appears to be thing I like that name more. |
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
NdJson
extractor and responseJsonLines
extractor and response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only skimmed but it looks good from that.
@@ -67,6 +68,9 @@ pub mod extract; | |||
pub mod response; | |||
pub mod routing; | |||
|
|||
#[cfg(feature = "json-lines")] | |||
pub mod json_lines; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In axum
, only the Json
type is exported at the root, not the json
module. Does this deviate from that because there's more types to expose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly!
This adds
JsonLines
which is a newline delimited JSON extractor and response. Its partly inspired byactix_web_lab::respond::NdJson
.I had a use case for this today and figured it makes sense to upstream.