(request: Request<Body>)
| 8 | |
| 9 | #[wstd::http_server] |
| 10 | async fn main(request: Request<Body>) -> Result<Response<Body>, Error> { |
| 11 | let path = request.uri().path_and_query().unwrap().as_str(); |
| 12 | println!("serving {path}"); |
| 13 | match path { |
| 14 | "/" => http_home(request).await, |
| 15 | "/wait-response" => http_wait_response(request).await, |
| 16 | "/wait-body" => http_wait_body(request).await, |
| 17 | "/stream-body" => http_stream_body(request).await, |
| 18 | "/echo" => http_echo(request).await, |
| 19 | "/echo-headers" => http_echo_headers(request).await, |
| 20 | "/echo-trailers" => http_echo_trailers(request).await, |
| 21 | "/response-status" => http_response_status(request).await, |
| 22 | "/response-fail" => http_response_fail(request).await, |
| 23 | "/response-body-fail" => http_body_fail(request).await, |
| 24 | _ => http_not_found(request).await, |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | async fn http_home(_request: Request<Body>) -> Result<Response<Body>> { |
| 29 | // To send a single string as the response body, use `Responder::respond`. |
nothing calls this directly
no test coverage detected