pub struct TestResponse {
pub response: Response,
}Expand description
A response with assertions attached, each returning self so they chain.
Fields§
§response: ResponseImplementations§
Source§impl TestResponse
impl TestResponse
pub fn status(&self) -> u16
pub fn body(&self) -> String
Sourcepub fn body_bytes(&self) -> &[u8] ⓘ
pub fn body_bytes(&self) -> &[u8] ⓘ
The raw body, for a response that is not text — a compressed one, say.
pub fn json(&self) -> Json
pub fn header(&self, name: &str) -> Option<&str>
pub fn assert_status(self, expected: u16) -> TestResponse
pub fn assert_ok(self) -> TestResponse
pub fn assert_not_found(self) -> TestResponse
Sourcepub fn assert_see(self, needle: &str) -> TestResponse
pub fn assert_see(self, needle: &str) -> TestResponse
Assert the body contains this text.
pub fn assert_dont_see(self, needle: &str) -> TestResponse
pub fn assert_header(self, name: &str, expected: &str) -> TestResponse
pub fn assert_redirect(self, location: &str) -> TestResponse
Sourcepub fn assert_json(self, path: &str, expected: impl Into<Json>) -> TestResponse
pub fn assert_json(self, path: &str, expected: impl Into<Json>) -> TestResponse
Assert a dotted path in the JSON body equals a value.
pub fn assert_json_missing(self, path: &str) -> TestResponse
Auto Trait Implementations§
impl !RefUnwindSafe for TestResponse
impl !UnwindSafe for TestResponse
impl Freeze 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