Struct gotham::test::TestClient
source · pub struct TestClient<TS: Server, C: Connect> { /* private fields */ }
Expand description
Client interface for issuing requests to a Server
.
Implementations§
source§impl<TS: Server + 'static, C: Connect + Clone + Send + Sync + 'static> TestClient<TS, C>
impl<TS: Server + 'static, C: Connect + Clone + Send + Sync + 'static> TestClient<TS, C>
sourcepub fn head<U>(&self, uri: U) -> TestRequest<'_, TS, C>
pub fn head<U>(&self, uri: U) -> TestRequest<'_, TS, C>
Begin constructing a HEAD request using this TestClient
.
sourcepub fn get<U>(&self, uri: U) -> TestRequest<'_, TS, C>
pub fn get<U>(&self, uri: U) -> TestRequest<'_, TS, C>
Begin constructing a GET request using this TestClient
.
sourcepub fn options<U>(&self, uri: U) -> TestRequest<'_, TS, C>
pub fn options<U>(&self, uri: U) -> TestRequest<'_, TS, C>
Begin constructing an OPTIONS request using this TestClient
.
sourcepub fn post<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C>
pub fn post<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C>
Begin constructing a POST request using this TestClient
.
sourcepub fn put<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C>
pub fn put<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C>
Begin constructing a PUT request using this TestClient
.
sourcepub fn patch<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C>
pub fn patch<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C>
Begin constructing a PATCH request using this TestClient
.
sourcepub fn delete<U>(&self, uri: U) -> TestRequest<'_, TS, C>
pub fn delete<U>(&self, uri: U) -> TestRequest<'_, TS, C>
Begin constructing a DELETE request using this TestClient
.
sourcepub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_, TS, C>
pub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_, TS, C>
Begin constructing a request with the given HTTP method and URI.
sourcepub fn build_request_with_body<B, U>(
&self,
method: Method,
uri: U,
body: B,
mime: Mime
) -> TestRequest<'_, TS, C>
pub fn build_request_with_body<B, U>( &self, method: Method, uri: U, body: B, mime: Mime ) -> TestRequest<'_, TS, C>
Begin constructing a request with the given HTTP method, URI and body.
sourcepub fn perform(&self, req: TestRequest<'_, TS, C>) -> Result<TestResponse>
pub fn perform(&self, req: TestRequest<'_, TS, C>) -> Result<TestResponse>
Send a constructed request using this TestClient
, and await the response.
Auto Trait Implementations§
impl<TS, C> Freeze for TestClient<TS, C>
impl<TS, C> !RefUnwindSafe for TestClient<TS, C>
impl<TS, C> Send for TestClient<TS, C>
impl<TS, C> Sync for TestClient<TS, C>
impl<TS, C> Unpin for TestClient<TS, C>
impl<TS, C> !UnwindSafe for TestClient<TS, C>
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