1
0
Fork 0
mirror of https://mzte.de/git/LordMZTE/brevo synced 2024-12-12 19:42:56 +01:00

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, body::BodyDeserializeError,
http::{uri::InvalidUri, Uri}, http::{uri::InvalidUri, Uri},
redirect, redirect,
reject::{self, Reject}, reject::{self, MethodNotAllowed, Reject},
reply, reply,
Rejection, Rejection,
Reply, Reply,
@ -120,7 +120,7 @@ pub async fn try_handle_reject(
brevo: Arc<Brevo>, brevo: Arc<Brevo>,
err: Rejection, err: Rejection,
) -> Result<Box<dyn Reply>, Rejection> { ) -> Result<Box<dyn Reply>, Rejection> {
if err.is_not_found() { if err.is_not_found() || err.find::<MethodNotAllowed>().is_some() {
let rendered = brevo let rendered = brevo
.tera .tera
.render("404.html", &Context::new()) .render("404.html", &Context::new())