Struct reqwest::unstable::async::Response
[−]
[src]
pub struct Response { /* fields omitted */ }
A Response to a submitted Request
.
Methods
impl Response
[src]
fn url(&self) -> &Url
[src]
Get the final Url
of this Response
.
fn status(&self) -> StatusCode
[src]
Get the StatusCode
of this Response
.
fn headers(&self) -> &Headers
[src]
Get the Headers
of this Response
.
fn headers_mut(&mut self) -> &mut Headers
[src]
Get a mutable reference to the Headers
of this Response
.
fn into_body(self) -> Decoder
[src]
Consumes the response, returning the body
fn body(&self) -> &Decoder
[src]
Get a reference to the response body.
fn body_mut(&mut self) -> &mut Decoder
[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
.
fn json<T: DeserializeOwned>(&mut self) -> Json<T>
[src]
Try to deserialize the response body as JSON using serde
.
fn error_for_status(self) -> Result<Self>
[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) ); } } }