pub struct HttpResponseBinary {
pub http_version: String,
pub status_code: u16,
pub status_text: String,
pub headers: HashMap<String, String>,
pub body: Vec<u8>,
}Expand description
A struct representing an HTTP response.
This struct contains all the components of an HTTP response: the HTTP version, status code, status text, headers, and body. It is used to model and manipulate HTTP responses within the application.
§Fields
http_version: A string representing the HTTP version (e.g., “HTTP/1.1”).status_code: The HTTP status code (e.g., 200 for OK, 404 for Not Found).status_text: A string containing the status text associated with the status code (e.g., “OK”, “Not Found”).headers: AHashMap<String, String>containing the headers of the response, where each key is the header name (e.g., “Content-Type”), and the value is the corresponding header value.body: AVec<u8>representing the body of the HTTP response, which contains the content being returned.
Fields§
§http_version: StringThe HTTP version of the response (e.g., “HTTP/1.1”).
status_code: u16The HTTP status code (e.g., 200, 404).
status_text: StringThe status text associated with the status code (e.g., “OK”, “Not Found”).
headers: HashMap<String, String>A HashMap of headers, where the key is the header name and the value is the header value.
body: Vec<u8>The body of the response, which contains the content being returned.
Trait Implementations§
Source§impl Clone for HttpResponseBinary
impl Clone for HttpResponseBinary
Source§fn clone(&self) -> HttpResponseBinary
fn clone(&self) -> HttpResponseBinary
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpResponseBinary
impl Debug for HttpResponseBinary
Source§impl Default for HttpResponseBinary
impl Default for HttpResponseBinary
Source§fn default() -> HttpResponseBinary
fn default() -> HttpResponseBinary
Source§impl PartialEq for HttpResponseBinary
impl PartialEq for HttpResponseBinary
Source§impl ResponseTrait for HttpResponseBinary
Implements the ResponseTrait trait for HttpResponseBinary.
impl ResponseTrait for HttpResponseBinary
Implements the ResponseTrait trait for HttpResponseBinary.
This implementation specifies the associated types for binary and text representations of HTTP responses, enabling seamless conversion and handling of HTTP response data.
§Associated Types
OutputText: Specifies the text representation of an HTTP response (HttpResponseText).OutputBinary: Specifies the binary representation of an HTTP response (HttpResponseBinary).
type OutputText = HttpResponseText
type OutputBinary = HttpResponseBinary
Source§fn from(response: &[u8]) -> HttpResponseBinarywhere
HttpResponseBinary: Sized,
fn from(response: &[u8]) -> HttpResponseBinarywhere
HttpResponseBinary: Sized,
Output. Read more