Struct rvcr::VCRMiddleware
source · pub struct VCRMiddleware { /* private fields */ }
Expand description
Pluggable VCR middleware for record-and-replay for reqwest items
Implementations§
source§impl VCRMiddleware
impl VCRMiddleware
Implements boilerplate for converting between vcr_cassette and reqwest structures.
Carries methods to find response in a cassette, and to record an interaction.
pub fn with_modify_request<F>(self, modifier: F) -> Self
pub fn with_modify_response<F>(self, modifier: F) -> Self
sourcepub fn with_search(self, search: VCRReplaySearch) -> Self
pub fn with_search(self, search: VCRReplaySearch) -> Self
Adjust search behavior for responses
sourcepub fn with_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_path(self, path: impl Into<PathBuf>) -> Self
Adjust path in the middleware and return it
sourcepub fn with_rich_diff(self, rich_diff: bool) -> Self
pub fn with_rich_diff(self, rich_diff: bool) -> Self
Adjust rich diff in the middleware and return it
Trait Implementations§
source§impl Drop for VCRMiddleware
impl Drop for VCRMiddleware
Save cassette interactions after the run
source§impl From<Cassette> for VCRMiddleware
impl From<Cassette> for VCRMiddleware
Create middleware instance from Cassette
source§impl Middleware for VCRMiddleware
impl Middleware for VCRMiddleware
Reqwest middleware implementation
It receives request, converts it to internal VCR format, and saves data in the internal.
source§fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Invoked with a request before sending it. If you want to continue processing the request,
you should explicitly call
next.run(req, extensions)
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for VCRMiddleware
impl Send for VCRMiddleware
impl Sync for VCRMiddleware
impl Unpin for VCRMiddleware
impl !UnwindSafe for VCRMiddleware
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more