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

pub struct Response { /* fields omitted */ }

A Response to a submitted Request.

Methods

impl Response
[src]

Get the final Url of this Response.

Get the remote address used to get this Response.

Get the StatusCode of this Response.

Get the Headers of this Response.

Get a mutable reference to the Headers of this Response.

Consumes the response, returning the body

Get a reference to the response body.

Get a mutable reference to the response body.

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

Get the HTTP Version of this Response.

Try to deserialize the response body as JSON using serde.

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::BAD_REQUEST)
            );
        }
    }
}

Trait Implementations

impl<T: Into<Body>> From<Response<T>> for Response
[src]

Performs the conversion.

impl Debug for Response
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Response

impl !Sync for Response

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<T> Erased for T
[src]