impl HttpMethod {
#[must_use]
pub fn from_str_val(s: &str) -> Self {
match s.to_lowercase().as_str() {
"get" => HttpMethod::Get,
"post" => HttpMethod::Post,
"update" => HttpMethod::Update,
"delete" => HttpMethod::Delete,
"put" => HttpMethod::Put,
"patch" => HttpMethod::Patch,
"head" => HttpMethod::Head,
"options" => HttpMethod::Options,
other => HttpMethod::Other(other.to_string()),
}
}
#[must_use]
pub fn other(s: impl Into<String>) -> Self {
Self::Other(s.into())
}
}
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub enum HttpMethod {
Get,
Post,
Delete,
Update,
Put,
Patch,
Head,
Options,
Other(String),
}