You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the code e.g. src/json_formats.rs seems to set Content-type to application/jsonstream for json-nl-stream, and src/stream_body_as.rs plugs it in HttpBody's poll_trailers, so I'm not sure what's wrong.
FWIW I was able to work around this by returning the header manually as follow (example); I ended up not using json so went for plain axum::body::StreamBody (might not have existed at the time?) but figured I might as well report this.
diff --git a/examples/json-example.rs b/examples/json-example.rs
index ae3de784bb87..1e3942fa371a 100644
--- a/examples/json-example.rs+++ b/examples/json-example.rs@@ -1,6 +1,7 @@
use axum::response::IntoResponse;
use axum::routing::*;
use axum::Router;
+use axum::http::header::CONTENT_TYPE;
use std::net::SocketAddr;
use futures::prelude::*;
@@ -30,7 +31,7 @@ async fn test_json_array_stream() -> impl IntoResponse {
}
async fn test_json_nl_stream() -> impl IntoResponse {
- StreamBodyAs::json_nl(source_test_stream())+ ([(CONTENT_TYPE, "application/jsonstream")], StreamBodyAs::json_nl(source_test_stream()))
}
#[tokio::main]
The text was updated successfully, but these errors were encountered:
Hi, thanks for this!
Running the example straight of this git, I do not seem to get a Content-Type header off the server:
(also tried csv with no difference)
In the code e.g. src/json_formats.rs seems to set Content-type to
application/jsonstream
forjson-nl-stream
, and src/stream_body_as.rs plugs it in HttpBody's poll_trailers, so I'm not sure what's wrong.FWIW I was able to work around this by returning the header manually as follow (example); I ended up not using json so went for plain
axum::body::StreamBody
(might not have existed at the time?) but figured I might as well report this.The text was updated successfully, but these errors were encountered: