From 2bbf6105d0859e46b6bcdb7876b4e81b9717d714 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sat, 21 Aug 2021 12:02:50 +0200 Subject: [PATCH] Fix 404 example (#226) Forgot to actually set the correct status code --- examples/global-404-handler/src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/global-404-handler/src/main.rs b/examples/global-404-handler/src/main.rs index c5c316f4..24ff75af 100644 --- a/examples/global-404-handler/src/main.rs +++ b/examples/global-404-handler/src/main.rs @@ -6,7 +6,8 @@ use axum::{ handler::{get, Handler}, - response::Html, + http::StatusCode, + response::{Html, IntoResponse}, Router, }; use std::net::SocketAddr; @@ -38,6 +39,6 @@ async fn handler() -> Html<&'static str> { Html("

Hello, World!

") } -async fn handler_404() -> &'static str { - "nothing to see here" +async fn handler_404() -> impl IntoResponse { + (StatusCode::NOT_FOUND, "nothing to see here") }