http_type/response/
type.rs

1use super::error::Error as ResponseError;
2use crate::*;
3
4///  Response body
5pub type ResponseBody = Vec<u8>;
6///  Response headers key
7pub type ResponseHeadersKey = String;
8///  Response headers value
9pub type ResponseHeadersValue = String;
10///  Response headers
11pub type ResponseHeaders = HashMap<ResponseHeadersKey, ResponseHeadersValue>;
12/// Response version
13pub type ResponseVersion = String;
14/// Response status code
15pub type ResponseStatusCode = usize;
16/// Response reason phrase
17pub type ResponseReasonPhrase = String;
18///  Response result
19pub type ResponseResult = Result<(), ResponseError>;
20
21/// Represents an HTTP response.
22///
23/// # Fields
24/// - `version`: The HTTP version of the response (e.g., HTTP/1.1).
25/// - `status_code`: The status code of the response (e.g., 200, 404).
26/// - `reason_phrase`: The reason phrase corresponding to the status code (e.g., OK, Not Found).
27/// - `headers`: A collection of HTTP headers as key-value pairs.
28/// - `body`: The binary body of the response.
29#[derive(Debug, Clone, Lombok, PartialEq, Eq, DisplayDebug)]
30pub struct Response {
31    #[set(skip)]
32    pub(super) version: ResponseVersion,
33    pub(super) status_code: ResponseStatusCode,
34    #[set(skip)]
35    pub(super) reason_phrase: ResponseReasonPhrase,
36    pub(super) headers: ResponseHeaders,
37    #[set(skip)]
38    pub(super) body: ResponseBody,
39}