Skip to content
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

Wait for the sender to be ready #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _stable/client/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ tokio::task::spawn(async move {
# .uri(url)
# .header(hyper::header::HOST, authority.as_str())
# .body(Empty::<Bytes>::new())?;
# sender.ready().await?;
# let mut res = sender.send_request(req).await?;
# Ok(())
# }
Expand Down Expand Up @@ -165,6 +166,7 @@ let req = Request::builder()
.body(Empty::<Bytes>::new())?;

// Await the response...
sender.ready().await?;
let mut res = sender.send_request(req).await?;

println!("Response status: {}", res.status());
Expand Down Expand Up @@ -220,6 +222,7 @@ use tokio::io::{stdout, AsyncWriteExt as _};
# .uri(url)
# .header(hyper::header::HOST, authority.as_str())
# .body(Empty::<Bytes>::new())?;
# sender.ready().await?;
# let mut res = sender.send_request(req).await?;
// Stream the body, writing each frame to stdout as it arrives
while let Some(next) = res.frame().await {
Expand Down