Struct gotham::test::TestClient
source · [−]Expand description
Client interface for issuing requests to a Server
.
Implementations
sourceimpl<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> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn head<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
Begin constructing a HEAD request using this TestClient
.
sourcepub fn get<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn get<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
Begin constructing a GET request using this TestClient
.
sourcepub fn options<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn options<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
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: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn post<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
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: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn put<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
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: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn patch<B, U>(&self, uri: U, body: B, mime: Mime) -> TestRequest<'_, TS, C> where
B: Into<Body>,
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
Begin constructing a PATCH request using this TestClient
.
sourcepub fn delete<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn delete<U>(&self, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
Begin constructing a DELETE request using this TestClient
.
sourcepub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
pub fn build_request<U>(&self, method: Method, uri: U) -> TestRequest<'_, TS, C> where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
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: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
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: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<Error>,
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
C: Send,
TS: Send,
impl<TS, C> Sync for TestClient<TS, C> where
C: Sync,
TS: Sync,
impl<TS, C> Unpin for TestClient<TS, C> where
C: Unpin,
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more