plantuml_server_client_rs/request/method.rs
1/// HTTP Method to request
2#[derive(Clone, Debug, PartialEq, Eq)]
3pub enum Method {
4 Post,
5 Get,
6}
7
8impl std::str::FromStr for Method {
9 type Err = anyhow::Error;
10
11 fn from_str(s: &str) -> anyhow::Result<Self> {
12 match s.to_string().to_lowercase().as_str() {
13 "post" => Ok(Self::Post),
14 "get" => Ok(Self::Get),
15 _ => anyhow::bail!("unsupported method"),
16 }
17 }
18}