pub struct Pretend<C, R, I>where
R: ResolveUrl,
I: InterceptRequest,{ /* private fields */ }
Expand description
The pretend HTTP client
This struct is the entry point for pretend
clients. It can be constructed with
an HTTP client implementation, and pretend
annotated traits will automatically
be implemented by this struct.
See crate level documentation for more information
Implementations§
source§impl<C, R, I> Pretend<C, R, I>where
R: ResolveUrl,
I: InterceptRequest,
impl<C, R, I> Pretend<C, R, I>where R: ResolveUrl, I: InterceptRequest,
sourcepub fn new(client: C, resolver: R, interceptor: I) -> Pretend<C, R, I>
pub fn new(client: C, resolver: R, interceptor: I) -> Pretend<C, R, I>
Constructor
This constructor takes a client implementation, an URL resolver and
an interceptor. Prefer using Pretend::for_client
and Pretend::with_url
.
sourcepub fn with_url(self, url: Url) -> Pretend<C, UrlResolver, I>
pub fn with_url(self, url: Url) -> Pretend<C, UrlResolver, I>
Set the base URL
Set the base URL for this client.
sourcepub fn with_request_interceptor<II>(self, interceptor: II) -> Pretend<C, R, II>where
II: InterceptRequest,
pub fn with_request_interceptor<II>(self, interceptor: II) -> Pretend<C, R, II>where II: InterceptRequest,
Set the request interceptor
Set the request interceptor for this client.
sourcepub fn with_url_resolver<RR>(self, resolver: RR) -> Pretend<C, RR, I>where
RR: ResolveUrl,
pub fn with_url_resolver<RR>(self, resolver: RR) -> Pretend<C, RR, I>where RR: ResolveUrl,
Set the URL resolver
Set the URL resolver for this client.
source§impl<C> Pretend<C, InvalidUrlResolver, NoopRequestInterceptor>
impl<C> Pretend<C, InvalidUrlResolver, NoopRequestInterceptor>
sourcepub fn for_client(
client: C
) -> Pretend<C, InvalidUrlResolver, NoopRequestInterceptor>
pub fn for_client( client: C ) -> Pretend<C, InvalidUrlResolver, NoopRequestInterceptor>
Constructor
This constructor takes a client implementation and
return an incomplete Pretend
client. Use Pretend::with_url
to
set the base URL.