pub struct TestClient<'a> { /* private fields */ }Expand description
Sends requests carrying cookies and tenant.
Implementations§
Source§impl<'a> TestClient<'a>
impl<'a> TestClient<'a>
pub fn new(router: &'a Router) -> Self
Attaches a cookie to every request; a later value for the same name replaces the earlier one.
Attaches every (name, value) pair, replacing earlier values for the
same name.
Sourcepub fn csrf(&self, token: &str) -> Self
pub fn csrf(&self, token: &str) -> Self
Attach the CSRF cookie the form’s csrf_token field must match.
Sourcepub fn tenant(&self, tenant: Uuid) -> Self
pub fn tenant(&self, tenant: Uuid) -> Self
Scopes the request to another tenant, taking precedence over the logged-in user’s tenant.
pub async fn get(&self, uri: &str) -> Response<Body>
pub async fn post_form(&self, uri: &str, body: String) -> Response<Body>
pub async fn post_multipart( &self, uri: &str, boundary: &str, body: String, ) -> Response<Body>
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TestClient<'a>
impl<'a> !UnwindSafe for TestClient<'a>
impl<'a> Freeze for TestClient<'a>
impl<'a> Send for TestClient<'a>
impl<'a> Sync for TestClient<'a>
impl<'a> Unpin for TestClient<'a>
impl<'a> UnsafeUnpin for TestClient<'a>
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