pub struct TestRequest { /* private fields */ }Implementations§
Source§impl TestRequest
impl TestRequest
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Sourcepub fn acting_as(self, secret: &str, subject: impl Display) -> Self
pub fn acting_as(self, secret: &str, subject: impl Display) -> Self
Act as a subject, skipping the login round-trip.
Signs a token with secret — the same one the application’s Jwt is
configured with — so the request goes through the real guard rather
than around it. A test that bypassed the guard would not be testing the
guard.
Sourcepub fn acting_as_with(
self,
secret: &str,
subject: impl Display,
claims: impl IntoIterator<Item = (String, Value)>,
) -> Self
pub fn acting_as_with( self, secret: &str, subject: impl Display, claims: impl IntoIterator<Item = (String, Value)>, ) -> Self
Act as a subject carrying extra claims.
Sourcepub fn with_session(self, cookie: impl Display) -> Self
pub fn with_session(self, cookie: impl Display) -> Self
Present a session cookie.
pub async fn send(self) -> TestResponse
Auto Trait Implementations§
impl !RefUnwindSafe for TestRequest
impl !UnwindSafe for TestRequest
impl Freeze for TestRequest
impl Send for TestRequest
impl Sync for TestRequest
impl Unpin for TestRequest
impl UnsafeUnpin for TestRequest
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