1
0
mirror of https://github.com/actix/examples synced 2025-06-27 01:27:43 +02:00
This commit is contained in:
Rob Ede
2022-07-09 21:05:06 +01:00
parent e97bc83f59
commit 4b801ba222
10 changed files with 55 additions and 42 deletions

View File

@ -43,7 +43,9 @@ async fn welcome(req: HttpRequest, session: Session) -> Result<HttpResponse> {
async fn default_handler(req_method: Method) -> Result<impl Responder> {
match req_method {
Method::GET => {
let file = NamedFile::open("static/404.html")?.set_status_code(StatusCode::NOT_FOUND);
let file = NamedFile::open("static/404.html")?
.customize()
.with_status(StatusCode::NOT_FOUND);
Ok(Either::Left(file))
}
_ => Ok(Either::Right(HttpResponse::MethodNotAllowed().finish())),