MCPcopy Create free account
hub / github.com/actix/examples / default_handler

Function default_handler

basics/basics/src/main.rs:46–56  ·  view source on GitHub ↗
(req_method: Method)

Source from the content-addressed store, hash-verified

44}
45
46async fn default_handler(req_method: Method) -> Result<impl Responder> {
47 match req_method {
48 Method::GET => {
49 let file = NamedFile::open("static/404.html")?
50 .customize()
51 .with_status(StatusCode::NOT_FOUND);
52 Ok(Either::Left(file))
53 }
54 _ => Ok(Either::Right(HttpResponse::MethodNotAllowed().finish())),
55 }
56}
57
58async fn streaming_response(path: web::Path<String>) -> HttpResponse {
59 let name = path.into_inner();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected