[][src]Struct reqwest::Response

pub struct Response { /* fields omitted */ }

A Response to a submitted Request.

Implementations

impl Response[src]

pub fn status(&self) -> StatusCode[src]

Get the StatusCode of this Response.

pub fn headers(&self) -> &HeaderMap[src]

Get the Headers of this Response.

pub fn headers_mut(&mut self) -> &mut HeaderMap[src]

Get a mutable reference to the Headers of this Response.

pub fn content_length(&self) -> Option<u64>[src]

Get the content-length of this response, if known.

Reasons it may not be known:

  • The server didn't send a content-length header.
  • The response is compressed and automatically decoded (thus changing

pub fn url(&self) -> &Url[src]

Get the final Url of this Response.

pub async fn json<T: DeserializeOwned>(self) -> Result<T>[src]

Try to deserialize the response body as JSON.

pub async fn text(self) -> Result<String>[src]

Get the response text.

pub async fn bytes(self) -> Result<Bytes>[src]

Get the response as bytes

pub fn error_for_status(self) -> Result<Self>[src]

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

pub fn error_for_status_ref(&self) -> Result<&Self>[src]

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

Trait Implementations

impl Debug for Response[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.