http_type/request/
type.rs

1use super::error::Error as RequestError;
2use crate::*;
3
4/// RequestMethod
5pub type RequestMethod = String;
6/// RequestHost
7pub type RequestHost = String;
8/// RequestPath
9pub type RequestPath = String;
10/// RequestQuerys key
11pub type RequestQuerysKey = String;
12/// RequestQuerys value
13pub type RequestQuerysValue = String;
14/// RequestQuerys
15pub type RequestQuerys = HashMap<RequestQuerysKey, RequestQuerysValue>;
16///  RequestBody
17pub type RequestBody = Vec<u8>;
18/// RequestHeaders key
19pub type RequestHeadersKey = String;
20/// RequestHeaders value
21pub type RequestHeadersValue = String;
22/// RequestHeaders
23pub type RequestHeaders = HashMap<RequestHeadersKey, RequestHeadersValue>;
24/// RequestNewResult
25pub type RequestNewResult = Result<Request, RequestError>;
26
27/// Represents an HTTP request.
28///
29/// # Fields
30/// - `method`: The HTTP method of the request (e.g., GET, POST).
31/// - `host`: The host of the request (e.g., example.com).
32/// - `path`: The path of the request (e.g., /api/v1/resource).
33/// - `query`: The query string of the request (e.g., ?key=value).
34/// - `headers`: A collection of HTTP headers as key-value pairs.
35/// - `body`: The binary body of the request.
36#[derive(Debug, Clone, Lombok, PartialEq, Eq)]
37pub struct Request {
38    #[set(skip)]
39    pub(super) method: RequestMethod,
40    #[set(skip)]
41    pub(super) host: RequestHost,
42    #[set(skip)]
43    pub(super) path: RequestPath,
44    pub(super) querys: RequestQuerys,
45    pub(super) headers: RequestHeaders,
46    #[set(skip)]
47    pub(super) body: RequestBody,
48}