Fix 404 example (#226)

Forgot to actually set the correct status code
This commit is contained in:
David Pedersen 2021-08-21 12:02:50 +02:00 committed by GitHub
parent 66a806630c
commit 2bbf6105d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,8 @@
use axum::{ use axum::{
handler::{get, Handler}, handler::{get, Handler},
response::Html, http::StatusCode,
response::{Html, IntoResponse},
Router, Router,
}; };
use std::net::SocketAddr; use std::net::SocketAddr;
@ -38,6 +39,6 @@ async fn handler() -> Html<&'static str> {
Html("<h1>Hello, World!</h1>") Html("<h1>Hello, World!</h1>")
} }
async fn handler_404() -> &'static str { async fn handler_404() -> impl IntoResponse {
"nothing to see here" (StatusCode::NOT_FOUND, "nothing to see here")
} }