Trait api::HttpResponse
[−]
[src]
pub trait HttpResponse {
type Body: Read;
fn status(&self) -> u16;
fn reason(&self) -> &str;
fn headers(&self) -> Headers;
fn body(&mut self) -> &mut Self::Body;
fn is_1xx(&self) -> bool { ... }
fn is_2xx(&self) -> bool { ... }
fn is_3xx(&self) -> bool { ... }
fn is_4xx(&self) -> bool { ... }
fn is_5xx(&self) -> bool { ... }
}It represents the Server response received by the client after sending a HTTP request.
Associated Types
Required Methods
fn status(&self) -> u16
Response's status code. It should be a integer between 100 and 599.
fn reason(&self) -> &str
Reason-phrase that describes the status code. i.e. 200 OK, 404 Not Found
fn headers(&self) -> Headers
Response's header. It contains metadata for the response.
e.g. Content-Type informs the client about the body MIME
and how to decode it.
fn body(&mut self) -> &mut Self::Body
Response's body contain the data sent back from the server.
Provided Methods
fn is_1xx(&self) -> bool
Return true if the status code is 1xx, otherwise return false.
fn is_2xx(&self) -> bool
Return true if the status code is 2xx, otherwise return false.
fn is_3xx(&self) -> bool
Return true if the status code is 3xx, otherwise return false.
fn is_4xx(&self) -> bool
Return true if the status code is 4xx, otherwise return false.
fn is_5xx(&self) -> bool
Return true if the status code is 5xx, otherwise return false.