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/// RequestQuery
14pub type RequestQuery = HashMap<String, String>;
15
16///  RequestBody
17pub type RequestBody = Vec<u8>;
18
19/// RequestHeaders
20pub type RequestHeaders = HashMap<String, String>;
21
22/// RequestNewResult
23pub type RequestNewResult = Result<Request, RequestError>;
24
25/// Represents an HTTP request.
26///
27/// # Fields
28/// - `method`: The HTTP method of the request (e.g., GET, POST).
29/// - `host`: The host of the request (e.g., example.com).
30/// - `path`: The path of the request (e.g., /api/v1/resource).
31/// - `query`: The query string of the request (e.g., ?key=value).
32/// - `headers`: A collection of HTTP headers as key-value pairs.
33/// - `body`: The binary body of the request.
34#[derive(Debug, Clone, Lombok, PartialEq, Eq)]
35pub struct Request {
36    #[set(skip)]
37    pub(crate) method: RequestMethod,
38    #[set(skip)]
39    pub(crate) host: RequestHost,
40    #[set(skip)]
41    pub(crate) path: RequestPath,
42    #[set(skip)]
43    pub(crate) query: RequestQuery,
44    pub(crate) headers: RequestHeaders,
45    #[set(skip)]
46    pub(crate) body: RequestBody,
47}