pub struct RequestBuilder { /* private fields */ }Implementations§
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn json<T: Serialize>(self, body: &T) -> Self
pub fn json<T: Serialize>(self, body: &T) -> Self
A JSON body. Sets Content-Type unless one was already given.
Sourcepub fn body(self, body: impl Into<String>) -> Self
pub fn body(self, body: impl Into<String>) -> Self
A raw body, for testing what the framework does with something malformed.
pub fn query(self, key: &str, value: impl Display) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn bearer(self, token: impl Display) -> Self
Sourcepub async fn send(self) -> TestResponse
pub async fn send(self) -> TestResponse
Run the request through the real stack.
§Panics
If the request could not be built or the service failed outright — neither is a condition a test can act on, and both mean the test itself is wrong.
Auto Trait Implementations§
impl !RefUnwindSafe for RequestBuilder
impl !UnwindSafe for RequestBuilder
impl Freeze for RequestBuilder
impl Send for RequestBuilder
impl Sync for RequestBuilder
impl Unpin for RequestBuilder
impl UnsafeUnpin for RequestBuilder
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