From 6b5941313591836a422ed1a080fcf58f1929b6cb Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Sun, 25 Jul 2021 18:28:58 +0200 Subject: [PATCH] also show 404 page for MethodNotAllowed --- src/handlers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/handlers.rs b/src/handlers.rs index 65f9817..d84b914 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -8,7 +8,7 @@ use warp::{ body::BodyDeserializeError, http::{uri::InvalidUri, Uri}, redirect, - reject::{self, Reject}, + reject::{self, MethodNotAllowed, Reject}, reply, Rejection, Reply, @@ -120,7 +120,7 @@ pub async fn try_handle_reject( brevo: Arc, err: Rejection, ) -> Result, Rejection> { - if err.is_not_found() { + if err.is_not_found() || err.find::().is_some() { let rendered = brevo .tera .render("404.html", &Context::new())