Struct gotham::test::TestClient
source · [−]Expand description
Client interface for issuing requests to a Server
.
Implementations
sourceimpl<TS: Server + 'static, C: Connect + 'static> TestClient<TS, C>
impl<TS: Server + 'static, C: Connect + 'static> TestClient<TS, C>
sourcepub fn head<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
pub fn head<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
Begin constructing a HEAD request using this TestClient
.
sourcepub fn get<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
pub fn get<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
Begin constructing a GET request using this TestClient
.
sourcepub fn options<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
pub fn options<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
Begin constructing an OPTIONS request using this TestClient
.
sourcepub fn post<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
pub fn post<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
Begin constructing a POST request using this TestClient
.
sourcepub fn put<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
pub fn put<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
Begin constructing a PUT request using this TestClient
.
sourcepub fn patch<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
pub fn patch<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
Begin constructing a PATCH request using this TestClient
.
sourcepub fn delete<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
pub fn delete<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
Begin constructing a DELETE request using this TestClient
.
sourcepub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
pub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_, TS, C> where
Uri: HttpTryFrom<U>,
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> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
pub fn build_request_with_body<B, U>(
&self,
method: Method,
uri: U,
body: B,
mime: Mime
) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: HttpTryFrom<U>,
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> !RefUnwindSafe for TestClient<TS, C>
impl<TS, C> Send for TestClient<TS, C> where
TS: Send,
impl<TS, C> Sync for TestClient<TS, C> where
TS: Sync,
impl<TS, C> Unpin for TestClient<TS, C> where
TS: Unpin,
impl<TS, C> !UnwindSafe for TestClient<TS, C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more