http_type/request/
type.rs

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