pub struct Response { /* private fields */ }Expand description
A response, with its body already read.
Implementations§
Source§impl Response
impl Response
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
The status code.
Sourcepub fn header(&self, name: &str) -> Option<&str>
pub fn header(&self, name: &str) -> Option<&str>
One header as a string, when it is valid UTF-8.
Sourcepub fn text(&self) -> Result<String, ClientError>
pub fn text(&self) -> Result<String, ClientError>
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T, ClientError>
pub fn json<T: DeserializeOwned>(&self) -> Result<T, ClientError>
Sourcepub fn error_for_status(self) -> Result<Self, ClientError>
pub fn error_for_status(self) -> Result<Self, ClientError>
Turn a 4xx or 5xx into an error, keeping 2xx and 3xx as values.
§Errors
ClientError::Transport carrying the status and the first part of the
body, which is usually where the reason is.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more