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