pub enum TestResponse {
Success(HttpResponse),
Error(Error),
}Expand description
Response from a test request
Variants§
Success(HttpResponse)
Error(Error)
Implementations§
Source§impl TestResponse
impl TestResponse
Sourcepub fn assert_success(&self) -> &HttpResponse
pub fn assert_success(&self) -> &HttpResponse
Assert the response is successful
Sourcepub fn assert_error(&self) -> &Error
pub fn assert_error(&self) -> &Error
Assert the response is an error
Sourcepub fn body_string(&self) -> Option<String>
pub fn body_string(&self) -> Option<String>
Get the response body as string
Sourcepub fn body_json<T: DeserializeOwned>(&self) -> Result<T, String>
pub fn body_json<T: DeserializeOwned>(&self) -> Result<T, String>
Get the response body as JSON
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TestResponse
impl !RefUnwindSafe for TestResponse
impl !UnwindSafe for TestResponse
impl Send for TestResponse
impl Sync for TestResponse
impl Unpin for TestResponse
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<R, D> DepsPresent<D> for R
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging