[−][src]Struct reqwest::async::Response
A Response to a submitted Request.
Methods
impl Response[src]
impl Responsepub fn url(&self) -> &Url[src]
pub fn url(&self) -> &UrlGet the final Url of this Response.
pub fn remote_addr(&self) -> Option<SocketAddr>[src]
pub fn remote_addr(&self) -> Option<SocketAddr>Get the remote address used to get this Response.
pub fn status(&self) -> StatusCode[src]
pub fn status(&self) -> StatusCodeGet the StatusCode of this Response.
pub fn headers(&self) -> &HeaderMap[src]
pub fn headers(&self) -> &HeaderMapGet the Headers of this Response.
pub fn headers_mut(&mut self) -> &mut HeaderMap[src]
pub fn headers_mut(&mut self) -> &mut HeaderMapGet a mutable reference to the Headers of this Response.
pub fn into_body(self) -> Decoder[src]
pub fn into_body(self) -> DecoderConsumes the response, returning the body
pub fn body(&self) -> &Decoder[src]
pub fn body(&self) -> &DecoderGet a reference to the response body.
pub fn body_mut(&mut self) -> &mut Decoder[src]
pub fn body_mut(&mut self) -> &mut DecoderGet a mutable reference to the response body.
The chunks from the body may be decoded, depending on the gzip
option on the ClientBuilder.
pub fn version(&self) -> Version[src]
pub fn version(&self) -> VersionGet the HTTP Version of this Response.
pub fn json<T: DeserializeOwned>(&mut self) -> Json<T>[src]
pub fn json<T: DeserializeOwned>(&mut self) -> Json<T>Try to deserialize the response body as JSON using serde.
pub fn error_for_status(self) -> Result<Self>[src]
pub fn error_for_status(self) -> Result<Self>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 Debug for Response[src]
impl Debug for Responsefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: Into<Body>> From<Response<T>> for Response[src]
impl<T: Into<Body>> From<Response<T>> for ResponseAuto Trait Implementations
Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow(&self) -> &T[src]
fn borrow(&self) -> &TImmutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 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]
impl<T> Erased for T