http_type/request/
type.rs

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