From 1ec1bfc0340c8face5321cc8bf9285620b3178e1 Mon Sep 17 00:00:00 2001 From: A248 Date: Fri, 28 Jul 2023 08:14:39 +0600 Subject: [PATCH] Wait for the sender to be ready --- _stable/client/basic.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/_stable/client/basic.md b/_stable/client/basic.md index 2a38c31..ba7c907 100644 --- a/_stable/client/basic.md +++ b/_stable/client/basic.md @@ -106,6 +106,7 @@ tokio::task::spawn(async move { # .uri(url) # .header(hyper::header::HOST, authority.as_str()) # .body(Empty::::new())?; +# sender.ready().await?; # let mut res = sender.send_request(req).await?; # Ok(()) # } @@ -153,6 +154,7 @@ let req = Request::builder() .body(Empty::::new())?; // Await the response... +sender.ready().await?; let mut res = sender.send_request(req).await?; println!("Response status: {}", res.status()); @@ -205,6 +207,7 @@ use tokio::io::{stdout, AsyncWriteExt as _}; # .uri(url) # .header(hyper::header::HOST, authority.as_str()) # .body(Empty::::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 {