HttpResponse

Trait HttpResponse 

Source
pub trait HttpResponse {
    type Body: Read;

    // Required methods
    fn status(&self) -> u16;
    fn reason(&self) -> &str;
    fn headers(&self) -> Headers;
    fn body(&mut self) -> &mut Self::Body;

    // Provided methods
    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 { ... }
}
Expand description

It represents the Server response received by the client after sending a HTTP request.

Required Associated Types§

Required Methods§

Source

fn status(&self) -> u16

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

Source

fn reason(&self) -> &str

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

Source

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.

Source

fn body(&mut self) -> &mut Self::Body

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

Provided Methods§

Source

fn is_1xx(&self) -> bool

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

Source

fn is_2xx(&self) -> bool

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

Source

fn is_3xx(&self) -> bool

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

Source

fn is_4xx(&self) -> bool

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

Source

fn is_5xx(&self) -> bool

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

Implementors§