http_type/request/
type.rs

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