Struct reqwest::Response [−][src]
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 the actual decoded length).
pub fn url(&self) -> &Url
[src]
Get the final Url
of this Response
.
pub async fn json<T: DeserializeOwned>(self) -> Result<T>
[src]
This is supported on crate feature
json
only.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
Auto Trait Implementations
impl !RefUnwindSafe for Response
impl !Send for Response
impl !Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,