From 7fe6aaf8c5ebef39788e2a01b60b187f94d5a4d8 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Thu, 9 Jan 2025 11:10:17 +0100 Subject: [PATCH] fix: set status code to 404 for the not found page (#244) --- src/server/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/mod.rs b/src/server/mod.rs index cbfc2d6..abbe08f 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -4,7 +4,7 @@ use actix_web::{ get, http::{ header::{ContentType, ETag, EntityTag}, - Uri, + StatusCode, Uri, }, web::{Html, Redirect, ServiceConfig, ThinData}, Either, HttpResponse, Resource, Responder, @@ -300,7 +300,10 @@ pub(crate) fn static_files(cfg: &mut ServiceConfig) { } pub(crate) async fn not_found() -> impl Responder { - Html::new(views::html::error::render_404().0) + ( + Html::new(views::html::error::render_404().0), + StatusCode::NOT_FOUND, + ) } static SELF_BASE_URL: LazyLock =