pub struct HttpResponseText {
pub http_version: String,
pub status_code: u16,
pub status_text: String,
pub headers: HashMap<String, String>,
pub body: String,
}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: StringThe body of the response, which contains the content being returned.
Trait Implementations§
Source§impl Clone for HttpResponseText
impl Clone for HttpResponseText
Source§fn clone(&self) -> HttpResponseText
fn clone(&self) -> HttpResponseText
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpResponseText
impl Debug for HttpResponseText
Source§impl Default for HttpResponseText
impl Default for HttpResponseText
Source§fn default() -> HttpResponseText
fn default() -> HttpResponseText
Source§impl PartialEq for HttpResponseText
impl PartialEq for HttpResponseText
Source§impl ResponseTrait for HttpResponseText
Implements the ResponseTrait trait for HttpResponseText.
impl ResponseTrait for HttpResponseText
Implements the ResponseTrait trait for HttpResponseText.
This implementation allows HttpResponseText to convert between text and binary
representations of HTTP responses. It provides methods for parsing raw responses, as well
as accessing text and binary formats.
§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]) -> <HttpResponseText as ResponseTrait>::OutputTextwhere
HttpResponseText: Sized,
fn from(response: &[u8]) -> <HttpResponseText as ResponseTrait>::OutputTextwhere
HttpResponseText: Sized,
Output. Read more