(_request: Request<Body>)
| 48 | } |
| 49 | |
| 50 | async fn http_wait_body(_request: Request<Body>) -> Result<Response<Body>> { |
| 51 | // Get the time now |
| 52 | let now = Instant::now(); |
| 53 | |
| 54 | let body = async move { |
| 55 | // Sleep for one second. |
| 56 | wstd::task::sleep(Duration::from_secs(1)).await; |
| 57 | |
| 58 | // Compute how long we slept for. |
| 59 | let elapsed = Instant::now().duration_since(now).as_millis(); |
| 60 | Ok::<_, Infallible>(Bytes::from(format!("slept for {elapsed} millis\n"))) |
| 61 | }; |
| 62 | |
| 63 | Ok(Response::new(Body::from_try_stream(once_future(body)))) |
| 64 | } |
| 65 | |
| 66 | async fn http_stream_body(_request: Request<Body>) -> Result<Response<Body>> { |
| 67 | // Get the time now |
no test coverage detected