pub struct TestResponse { /* private fields */ }Expand description
A wrapper around reqwest::Response that provides common methods with internal unwrap()s.
This is conventient for tests where panics are what you want. For access to
non-panicking versions or the complete Response API use into_inner() or
as_ref().
Implementations§
Source§impl TestResponse
impl TestResponse
pub async fn text(self) -> String
pub async fn bytes(self) -> Bytes
pub async fn json<T>(self) -> Twhere
T: DeserializeOwned,
pub fn status(&self) -> StatusCode
pub fn headers(&self) -> &HeaderMap
pub async fn chunk(&mut self) -> Option<Bytes>
pub async fn chunk_text(&mut self) -> Option<String>
Sourcepub fn into_inner(self) -> Response
pub fn into_inner(self) -> Response
Get the inner reqwest::Response for less convenient but more complete access.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TestResponse
impl !RefUnwindSafe for TestResponse
impl Send for TestResponse
impl Sync for TestResponse
impl Unpin for TestResponse
impl !UnwindSafe for TestResponse
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