fn parse_method(src: &str) -> Result<Method, InvalidHttpMethodError> {
    match src.to_uppercase().as_str() {
        "GET" => Ok(Method::GET),
        "PUT" => Ok(Method::PUT),
        "POST" => Ok(Method::POST),
        "HEAD" => Ok(Method::HEAD),
        "PATCH" => Ok(Method::PATCH),
        "TRACE" => Ok(Method::TRACE),
        "DELETE" => Ok(Method::DELETE),
        "OPTIONS" => Ok(Method::OPTIONS),
        "CONNECT" => Ok(Method::CONNECT),
        _ => Err(InvalidHttpMethodError),
    }
}
/// Parse HTTP method from string. Throws error if invalid/unknown HTTP method
Parse HTTP method from string. Throws error if invalid/unknown HTTP method
Parse HTTP method from string . Throws error if invalid / unknown HTTP method
fn parse_method(src: &str) -> Result<Method, InvalidHttpMethodError> {
    match src.to_uppercase().as_str() {
        "GET" => Ok(Method::GET),
        "PUT" => Ok(Method::PUT),
        "POST" => Ok(Method::POST),
        "HEAD" => Ok(Method::HEAD),
        "PATCH" => Ok(Method::PATCH),
        "TRACE" => Ok(Method::TRACE),
        "DELETE" => Ok(Method::DELETE),
        "OPTIONS" => Ok(Method::OPTIONS),
        "CONNECT" => Ok(Method::CONNECT),
        _ => Err(InvalidHttpMethodError),
    }
}
fn parse_method ( src : & str ) -> Result < Method , InvalidHttpMethodError > { match src . to_uppercase ( ) . as_str ( ) { " " => Ok ( Method :: GET ) , " " => Ok ( Method :: PUT ) , " " => Ok ( Method :: POST ) , " " => Ok ( Method :: HEAD ) , " " => Ok ( Method :: PATCH ) , " " => Ok ( Method :: TRACE ) , " " => Ok ( Method :: DELETE ) , " " => Ok ( Method :: OPTIONS ) , " " => Ok ( Method :: CONNECT ) , _ => Err ( InvalidHttpMethodError ) , } }
Parse HTTP method from string.
Parse HTTP method from string .
src
&str