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

Response's status code. It should be a integer between 100 and 599.

Reason-phrase that describes the status code. i.e. 200 OK, 404 Not Found

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.

Response's body contain the data sent back from the server.

Provided Methods

Return true if the status code is 1xx, otherwise return false.

Return true if the status code is 2xx, otherwise return false.

Return true if the status code is 3xx, otherwise return false.

Return true if the status code is 4xx, otherwise return false.

Return true if the status code is 5xx, otherwise return false.

Implementors