http_type/response/
type.rs

1use crate::*;
2
3///  Response body
4pub type ResponseBody = Vec<u8>;
5///  Response body string
6pub type ResponseBodyString = String;
7///  Response headers key
8pub type ResponseHeadersKey = String;
9///  Response headers value
10pub type ResponseHeadersValue = String;
11///  Response headers
12pub type ResponseHeaders = HashMapXxHash3_64<ResponseHeadersKey, ResponseHeadersValue>;
13/// Response version
14pub type ResponseVersion = String;
15/// Response status code
16pub type ResponseStatusCode = usize;
17/// Response reason phrase
18pub type ResponseReasonPhrase = String;
19///  Response result
20pub type ResponseResult = Result<(), ResponseError>;
21/// Response data
22pub type ResponseData = Vec<u8>;
23/// Response data string
24pub type ResponseDataString = String;
25/// RwLockReadGuardResponse
26pub type RwLockReadGuardResponse<'a> = RwLockReadGuard<'a, Response>;
27/// RwLockWriteGuardResponse
28pub type RwLockWriteGuardResponse<'a> = RwLockWriteGuard<'a, Response>;
29
30/// Represents an HTTP response.
31///
32/// # Fields
33/// - `version`: The HTTP version of the response.
34/// - `status_code`: The status code of the response.
35/// - `reason_phrase`: The reason phrase corresponding to the status code.
36/// - `headers`: A collection of HTTP headers as key-value pairs.
37/// - `body`: The binary body of the response.
38#[derive(Debug, Clone, Lombok, DisplayDebug)]
39pub struct Response {
40    #[set(skip)]
41    pub(super) version: ResponseVersion,
42    pub(super) status_code: ResponseStatusCode,
43    #[set(skip)]
44    pub(super) reason_phrase: ResponseReasonPhrase,
45    pub(super) headers: ResponseHeaders,
46    #[set(skip)]
47    pub(super) body: ResponseBody,
48}