This commit is contained in:
Rob Ede 2023-01-31 14:41:01 +00:00 committed by GitHub
parent d6a09f0bed
commit f86afa1e51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -27,13 +27,13 @@ macro_rules! method_type {
fn parse(method: &str) -> Result<Self, String> { fn parse(method: &str) -> Result<Self, String> {
match method { match method {
$(stringify!($upper) => Ok(Self::$variant),)+ $(stringify!($upper) => Ok(Self::$variant),)+
_ => { if method.chars().all(|c| c.is_ascii_uppercase()) { _ => {
Ok(Self::Custom) if method.chars().all(|c| c.is_ascii_uppercase()) {
} else { Ok(Self::Custom)
Err(format!("HTTP method must be uppercase: `{}`", method)) } else {
} Err(format!("HTTP method must be uppercase: `{}`", method))
}, }
// _ => Err(format!("Unexpected HTTP method: `{}`", method)), },
} }
} }