canic_core/domain/http.rs
1//! Module: domain::http
2//!
3//! Responsibility: define pure HTTP value enums shared by HTTP ops, runtime
4//! metrics, and boundary DTOs.
5//! Does not own: raw IC management HTTP payloads, HTTP request/response DTO
6//! structs, metrics storage, or workflow retry policy.
7//! Boundary: ops, metrics, and DTO modules re-export these values to preserve
8//! public API paths while conversion from foreign infra payloads remains
9//! explicit.
10
11use candid::CandidType;
12use serde::Deserialize;
13
14///
15/// HttpMethod
16///
17
18#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq)]
19pub enum HttpMethod {
20 #[serde(rename = "get", alias = "GET")]
21 Get,
22 #[serde(rename = "head", alias = "HEAD")]
23 Head,
24 #[serde(rename = "post", alias = "POST")]
25 Post,
26}
27
28impl HttpMethod {
29 #[must_use]
30 pub const fn as_str(self) -> &'static str {
31 match self {
32 Self::Get => "GET",
33 Self::Head => "HEAD",
34 Self::Post => "POST",
35 }
36 }
37}