pub struct GenericClient { /* private fields */ }
Expand description
Provides an interface over the different client types which you can use in your code
if you want to avoid it having to be generic over the Client
trait.
Implementations§
Source§impl GenericClient
impl GenericClient
Sourcepub fn replay_file<P: Into<PathBuf>>(replay_file: P) -> Self
pub fn replay_file<P: Into<PathBuf>>(replay_file: P) -> Self
Create a GenericClient
using ReplayClient
internally, recording one single
request to one single replay file. If a differing request is made, the file will be
overwritten again.
Sourcepub fn replay_dir<P: Into<PathBuf>>(replay_dir: P) -> Self
pub fn replay_dir<P: Into<PathBuf>>(replay_dir: P) -> Self
Create a GenericClient
using ReplayClient
internally, recording multiple requests
to a single directory. Each unique request will get its own replay file independent of
other requests in the specified directory.
Sourcepub fn stub(client: StubClient) -> Self
pub fn stub(client: StubClient) -> Self
Create a GenericClient
using StubClient
internally.
Sourcepub fn force_record_next(&self)
pub fn force_record_next(&self)
If this is a ReplayClient it will inform the Replay Client that whichever next request is made should be recorded again, even if it has been made exactly this way before.
Trait Implementations§
Source§impl Client for GenericClient
impl Client for GenericClient
Source§fn execute(
&self,
config: Option<&ClientConfig>,
request: Request,
) -> Result<Response, Error>
fn execute( &self, config: Option<&ClientConfig>, request: Request, ) -> Result<Response, Error>
Source§fn config(&self) -> &ClientConfig
fn config(&self) -> &ClientConfig
Source§fn config_mut(&mut self) -> &mut ClientConfig
fn config_mut(&mut self) -> &mut ClientConfig
Source§fn get<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
fn get<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
GET
request to a URL.Source§fn post<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
fn post<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
POST
request to a URL.Source§fn put<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
fn put<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
PUT
request to a URL.Source§fn patch<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
fn patch<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
PATCH
request to a URL.Source§fn delete<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
fn delete<'cl, U: IntoUrl>(&'cl self, url: U) -> RequestBuilder<'cl, Self>
DELETE
request to a URL.