pub struct HttpResponse { /* private fields */ }Expand description
Representation of an HTTP response.
Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn is<K: AsRef<str>, V: AsRef<str>>(&self, name: K, expected: V) -> bool
pub fn is<K: AsRef<str>, V: AsRef<str>>(&self, name: K, expected: V) -> bool
Returns true if this response has a header with the given name
that matches the expected value.
Comparisons are made in a case-insensitive manner.
Sourcepub fn has<K: AsRef<str>, V: AsRef<str>>(&self, name: K, expected: V) -> bool
pub fn has<K: AsRef<str>, V: AsRef<str>>(&self, name: K, expected: V) -> bool
Returns true if this response has a header with the given name
that has a comma-separated list of values, and one of those values
matches the expected value.
Comparisons are made in a case-insensitive manner. Each value of the comma-separated list is trimmed before comparison.
Sourcepub fn is_informational(&self) -> bool
pub fn is_informational(&self) -> bool
Returns true if this response has a 1xx Informational status code.
Sourcepub fn is_successful(&self) -> bool
pub fn is_successful(&self) -> bool
Returns true if this response has a 2xx Successful status code.
Sourcepub fn is_redirection(&self) -> bool
pub fn is_redirection(&self) -> bool
Returns true if this response has a 3xx Redirection status code.
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Returns true if this response has a 4xx Client Error status code.
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Returns true if this response isisis a 5xx Server Error status code.
Trait Implementations§
Source§impl Debug for HttpResponse
impl Debug for HttpResponse
Source§impl Display for HttpResponse
impl Display for HttpResponse
impl Eq for HttpResponse
Source§impl<'a> Index<&'a str> for HttpResponse
impl<'a> Index<&'a str> for HttpResponse
Source§impl PartialEq for HttpResponse
impl PartialEq for HttpResponse
Source§fn eq(&self, other: &HttpResponse) -> bool
fn eq(&self, other: &HttpResponse) -> bool
self and other values to be equal, and is used by ==.