pub struct TestClient { /* private fields */ }Implementations§
Source§impl TestClient
impl TestClient
pub fn new(router: Router) -> Self
Sourcepub fn with_context(self, context: Context) -> Self
pub fn with_context(self, context: Context) -> Self
Use an application context, so handlers can resolve real services.
pub async fn send(&self, request: Request) -> TestResponse
The cookies this client is currently holding.
Forget every cookie — the equivalent of a fresh browser.
pub async fn get(&self, path: &str) -> TestResponse
pub async fn delete(&self, path: &str) -> TestResponse
pub async fn post(&self, path: &str, form: &[(&str, &str)]) -> TestResponse
pub async fn post_json(&self, path: &str, body: Json) -> TestResponse
pub async fn put_json(&self, path: &str, body: Json) -> TestResponse
Auto Trait Implementations§
impl !RefUnwindSafe for TestClient
impl !UnwindSafe for TestClient
impl Freeze for TestClient
impl Send for TestClient
impl Sync for TestClient
impl Unpin for TestClient
impl UnsafeUnpin for TestClient
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