We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What's the best way to stream a response body using 0.10.0-alpha?
I know there is access to the chunks of a response with https://docs.rs/reqwest/0.10.0-alpha.1/reqwest/struct.Response.html#method.chunk but I'd like to access the Decoder to use the Stream trait.
Previously, this could be done using into_body, but there does not appear to be an equivalent.
into_body
The text was updated successfully, but these errors were encountered:
For now, I'm reluctant to expose a Stream interface. But it's fairly straight-forward to create one using the async fn chunk with unfold:
Stream
async fn chunk
unfold
let stream = futures::stream::unfold(resp, |mut resp| async move { let result = resp.chunk().await; match result { Ok(Some(chunk)) => Some((Ok(chunk), resp)), Ok(None) => None, Err(err) => Some((Err(err), resp)), } });
Sorry, something went wrong.
No branches or pull requests
What's the best way to stream a response body using 0.10.0-alpha?
I know there is access to the chunks of a response with https://docs.rs/reqwest/0.10.0-alpha.1/reqwest/struct.Response.html#method.chunk but I'd like to access the Decoder to use the Stream trait.
Previously, this could be done using
into_body
, but there does not appear to be an equivalent.The text was updated successfully, but these errors were encountered: