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/// OptionResponseHeadersValue
30pub type OptionResponseHeadersValue = Option<ResponseHeadersValue>;
31
32/// Represents an HTTP response.
33///
34/// # Fields
35/// - `version`: The HTTP version of the response.
36/// - `status_code`: The status code of the response.
37/// - `reason_phrase`: The reason phrase corresponding to the status code.
38/// - `headers`: A collection of HTTP headers as key-value pairs.
39/// - `body`: The binary body of the response.
40#[derive(Debug, Clone, Lombok, DisplayDebug)]
41pub struct Response {
42    #[set(skip)]
43    pub(super) version: ResponseVersion,
44    pub(super) status_code: ResponseStatusCode,
45    #[set(skip)]
46    pub(super) reason_phrase: ResponseReasonPhrase,
47    pub(super) headers: ResponseHeaders,
48    #[set(skip)]
49    pub(super) body: ResponseBody,
50}