1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use http::Method;
use vector_lib::configurable::configurable_component;

/// HTTP method.
#[configurable_component]
#[derive(Clone, Copy, Debug)]
#[serde(rename_all = "UPPERCASE")]
pub enum HttpMethod {
    /// HTTP HEAD method.
    Head,

    /// HTTP GET method.
    Get,

    /// HTTP POST method.
    Post,

    /// HTTP Put method.
    Put,

    /// HTTP PATCH method.
    Patch,

    /// HTTP DELETE method.
    Delete,

    /// HTTP OPTIONS method.
    Options,
}

impl From<HttpMethod> for Method {
    fn from(http_method: HttpMethod) -> Self {
        match http_method {
            HttpMethod::Head => Self::HEAD,
            HttpMethod::Get => Self::GET,
            HttpMethod::Post => Self::POST,
            HttpMethod::Put => Self::PUT,
            HttpMethod::Patch => Self::PATCH,
            HttpMethod::Delete => Self::DELETE,
            HttpMethod::Options => Self::OPTIONS,
        }
    }
}