http_request/response/response_binary/
struct.rs

1use crate::*;
2
3/// A struct representing an HTTP response.
4///
5/// This struct contains all the components of an HTTP response: the HTTP version, status code,
6/// status text, headers, and body. It is used to model and manipulate HTTP responses within the
7/// application.
8///
9/// # Fields
10/// - `http_version`: A string representing the HTTP version (e.g., "HTTP/1.1").
11/// - `status_code`: The HTTP status code (e.g., 200 for OK, 404 for Not Found).
12/// - `status_text`: A string containing the status text associated with the status code (e.g., "OK", "Not Found").
13/// - `headers`: A `HashMap<String, String>` containing the headers of the response, where each key is the header name
14///   (e.g., "Content-Type"), and the value is the corresponding header value.
15/// - `body`: A `Vec<u8>` representing the body of the HTTP response, which contains the content being returned.
16#[derive(Debug, Clone)]
17pub struct HttpResponseBinary {
18    /// The HTTP version of the response (e.g., "HTTP/1.1").
19    pub(crate) http_version: ArcRwLock<HttpVersion>,
20
21    /// The HTTP status code (e.g., 200, 404).
22    pub(crate) status_code: ResponseStatusCode,
23
24    /// The status text associated with the status code (e.g., "OK", "Not Found").
25    pub(crate) status_text: ArcRwLock<String>,
26
27    /// A `HashMap` of headers, where the key is the header name and the value is the header value.
28    pub(crate) headers: ArcRwLock<ResponseHeaders>,
29
30    /// The body of the response, which contains the content being returned.
31    pub(crate) body: ArcRwLock<RequestBody>,
32}