Struct gotham::test::TestClient
source · pub struct TestClient { /* private fields */ }
Expand description
Client interface for issuing requests to a TestServer
.
Implementations§
source§impl TestClient
impl TestClient
sourcepub fn head<U>(&self, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
pub fn head<U>(&self, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
Begin constructing a HEAD request using this TestClient
.
sourcepub fn get<U>(&self, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
pub fn get<U>(&self, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
Begin constructing a GET request using this TestClient
.
sourcepub fn options<U>(&self, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
pub fn options<U>(&self, uri: U) -> TestRequest<'_>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<'_>where
B: Into<Body>,
Uri: HttpTryFrom<U>,
pub fn post<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_>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<'_>where
B: Into<Body>,
Uri: HttpTryFrom<U>,
pub fn put<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_>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<'_>where
B: Into<Body>,
Uri: HttpTryFrom<U>,
pub fn patch<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_>where
B: Into<Body>,
Uri: HttpTryFrom<U>,
Begin constructing a PATCH request using this TestClient
.
sourcepub fn delete<U>(&self, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
pub fn delete<U>(&self, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
Begin constructing a DELETE request using this TestClient
.
sourcepub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_>where
Uri: HttpTryFrom<U>,
pub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_>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<'_>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<'_>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<'_>) -> Result<TestResponse>
pub fn perform(&self, req: TestRequest<'_>) -> Result<TestResponse>
Send a constructed request using this TestClient
, and await the response.