diff --git a/src/error.rs b/src/error.rs index eaf7675..361a813 100644 --- a/src/error.rs +++ b/src/error.rs @@ -23,7 +23,7 @@ use hmac::digest::InvalidLength as HmacInvalidLength; #[derive(Debug)] pub(crate) enum Error { - MethodMismatch, + MethodMismatch(hyper::Method), InvalidSecret, InvalidContentType, InvalidSignature, @@ -43,7 +43,7 @@ impl StdError for Error {} impl std::fmt::Display for Error { fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - Error::MethodMismatch => write!(fmt, "the method is invalid"), + Error::MethodMismatch(method) => write!(fmt, "method is invalid {method}, expected POST"), Error::InvalidSecret => write!(fmt, "the secret is invalid"), Error::InvalidContentType => write!(fmt, "the content-type is invalid"), Error::InvalidSignature => write!(fmt, "the signature is invalid"), diff --git a/src/web.rs b/src/web.rs index 1143178..499f186 100644 --- a/src/web.rs +++ b/src/web.rs @@ -44,7 +44,7 @@ fn error_res(e: E) -> Result>, Infallib async fn hooks_inner(req: Request, secret: &str) -> Result { match req.method() { &Method::POST => (), - _ => return Err(Error::MethodMismatch), + _ => return Err(Error::MethodMismatch(req.method().clone())), } debug!("Headers: {:?}", req.headers());