pub struct Response { /* private fields */ }Expand description
HTTP response wrapper.
Implementations§
Source§impl Response
impl Response
pub fn status(&self) -> StatusCode
pub fn headers(&self) -> &HeaderMap
pub fn bytes(&self) -> &Bytes
pub fn url(&self) -> Option<&Url>
pub fn is_success(&self) -> bool
Sourcepub fn error_for_status(&self) -> Result<()>
pub fn error_for_status(&self) -> Result<()>
Returns an error if the status is not success.
Sourcepub fn into_text(self) -> Result<String>
pub fn into_text(self) -> Result<String>
Reads the body as UTF-8 after checking for a success status.
Sourcepub async fn text(self) -> Result<String>
pub async fn text(self) -> Result<String>
Reads the body as UTF-8 after checking for a success status.
Sourcepub fn into_bytes_checked(self) -> Result<Bytes>
pub fn into_bytes_checked(self) -> Result<Bytes>
Returns the body after checking for a success status.
Sourcepub async fn bytes_checked(self) -> Result<Bytes>
pub async fn bytes_checked(self) -> Result<Bytes>
Returns the body after checking for a success status.
pub fn into_json<T: DeserializeOwned>(self) -> Result<T>
pub async fn json<T: DeserializeOwned>(self) -> Result<T>
pub fn into_json_unchecked<T: DeserializeOwned>(self) -> Result<T>
pub async fn json_unchecked<T: DeserializeOwned>(self) -> Result<T>
pub fn into_parts(self) -> (StatusCode, HeaderMap, Bytes)
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