also show 404 page for MethodNotAllowed

This commit is contained in:
LordMZTE 2021-07-25 18:28:58 +02:00
parent e8ecdfef34
commit 6b59413135

View file

@ -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<Brevo>,
err: Rejection,
) -> Result<Box<dyn Reply>, Rejection> {
if err.is_not_found() {
if err.is_not_found() || err.find::<MethodNotAllowed>().is_some() {
let rendered = brevo
.tera
.render("404.html", &Context::new())