Struct reqwest::unstable::async::Response [] [src]

pub struct Response { /* fields omitted */ }

A Response to a submitted Request.

Methods

impl Response
[src]

[src]

Get the final Url of this Response.

[src]

Get the StatusCode of this Response.

[src]

Get the Headers of this Response.

[src]

Get a mutable reference to the Headers of this Response.

[src]

Consumes the response, returning the body

[src]

Get a reference to the response body.

[src]

Get a mutable reference to the response body.

The chunks from the body may be decoded, depending on the gzip option on the ClientBuilder.

[src]

Try to deserialize the response body as JSON using serde.

[src]

Turn a response into an error if the server returned an error.

Example

fn on_response(res: Response) {
    match res.error_for_status() {
        Ok(_res) => (),
        Err(err) => {
            // asserting a 400 as an example
            // it could be any status between 400...599
            assert_eq!(
                err.status(),
                Some(reqwest::StatusCode::BadRequest)
            );
        }
    }
}

Trait Implementations

impl Debug for Response
[src]

[src]

Formats the value using the given formatter.