vector/sources/util/http/
method.rs

1use http::Method;
2use vector_lib::configurable::configurable_component;
3
4/// HTTP method.
5#[configurable_component]
6#[derive(Clone, Copy, Debug)]
7#[serde(rename_all = "UPPERCASE")]
8pub enum HttpMethod {
9    /// HTTP HEAD method.
10    Head,
11
12    /// HTTP GET method.
13    Get,
14
15    /// HTTP POST method.
16    Post,
17
18    /// HTTP Put method.
19    Put,
20
21    /// HTTP PATCH method.
22    Patch,
23
24    /// HTTP DELETE method.
25    Delete,
26
27    /// HTTP OPTIONS method.
28    Options,
29}
30
31impl From<HttpMethod> for Method {
32    fn from(http_method: HttpMethod) -> Self {
33        match http_method {
34            HttpMethod::Head => Self::HEAD,
35            HttpMethod::Get => Self::GET,
36            HttpMethod::Post => Self::POST,
37            HttpMethod::Put => Self::PUT,
38            HttpMethod::Patch => Self::PATCH,
39            HttpMethod::Delete => Self::DELETE,
40            HttpMethod::Options => Self::OPTIONS,
41        }
42    }
43}