pub struct TestRequestBuilder { /* private fields */ }Expand description
Fluent HTTP Request Builder untuk pengujian
Implementations§
Source§impl TestRequestBuilder
impl TestRequestBuilder
pub fn new(router: Router, method: &str, uri: &str) -> TestRequestBuilder
Sourcepub fn with_header(self, key: &str, value: &str) -> TestRequestBuilder
pub fn with_header(self, key: &str, value: &str) -> TestRequestBuilder
Tambahkan header HTTP kustom
Sourcepub fn with_token(self, token: &str) -> TestRequestBuilder
pub fn with_token(self, token: &str) -> TestRequestBuilder
Tambahkan Bearer token ke header Authorization
Sourcepub fn acting_as(self, user: AuthUser) -> TestRequestBuilder
pub fn acting_as(self, user: AuthUser) -> TestRequestBuilder
Simulasikan user yang sedang login via AuthUser extension
Sourcepub fn with_json<T>(self, body: T) -> TestRequestBuilderwhere
T: Serialize,
pub fn with_json<T>(self, body: T) -> TestRequestBuilderwhere
T: Serialize,
Kirim payload JSON
Sourcepub fn with_form(self, pairs: &[(&str, &str)]) -> TestRequestBuilder
pub fn with_form(self, pairs: &[(&str, &str)]) -> TestRequestBuilder
Kirim payload URL-encoded form data
Sourcepub async fn send(self) -> TestResponse
pub async fn send(self) -> TestResponse
Eksekusi request dan kembalikan TestResponse fluen
Auto Trait Implementations§
impl !RefUnwindSafe for TestRequestBuilder
impl !UnwindSafe for TestRequestBuilder
impl Forget for TestRequestBuilder
impl Freeze for TestRequestBuilder
impl Move for TestRequestBuilder
impl Send for TestRequestBuilder
impl Sync for TestRequestBuilder
impl Unpin for TestRequestBuilder
impl UnsafeUnpin for TestRequestBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more