From f7067ed63f7f9f38c02a12a17d65f3eae74e8c6f Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 21 May 2020 16:30:17 +0800 Subject: [PATCH] Update async_graphql_tide::ResponseExt::body_graphql_stream --- async-graphql-tide/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/async-graphql-tide/src/lib.rs b/async-graphql-tide/src/lib.rs index a5a74284..107d081d 100644 --- a/async-graphql-tide/src/lib.rs +++ b/async-graphql-tide/src/lib.rs @@ -154,9 +154,8 @@ impl ResponseExt for Response { // I created an issue and got a reply that this might be fixed in the future. // https://github.com/http-rs/http-types/pull/144 // Now I can only use forwarding to solve the problem. - let mut stream = StreamBody::new(Box::pin( - multipart_stream(stream).map(Result::Ok::<_, std::io::Error>), - )); + let mut stream = + Box::pin(multipart_stream(stream).map(Result::Ok::<_, std::io::Error>)); let (mut tx, rx) = mpsc::channel(0); async_std::task::spawn(async move { while let Some(item) = stream.next().await { @@ -165,7 +164,7 @@ impl ResponseExt for Response { } } }); - self.set_body(Body::from_reader(BufReader::new(rx), None)); + self.set_body(Body::from_reader(BufReader::new(StreamBody::new(rx)), None)); Ok(self.set_header(tide::http::headers::CONTENT_TYPE, "multipart/mixed")) } }