use hyper::Method;
pub const HTTP_SUPPORTED_METHODS: &[Method; 3] = &[Method::OPTIONS, Method::HEAD, Method::GET];
pub trait MethodExt {
fn is_allowed(&self) -> bool;
fn is_get(&self) -> bool;
fn is_head(&self) -> bool;
fn is_options(&self) -> bool;
}
impl MethodExt for Method {
fn is_allowed(&self) -> bool {
HTTP_SUPPORTED_METHODS.iter().any(|h| self == h)
}
fn is_get(&self) -> bool {
self == Method::GET
}
fn is_head(&self) -> bool {
self == Method::HEAD
}
fn is_options(&self) -> bool {
self == Method::OPTIONS
}
}