pub struct ReplayTransport { /* private fields */ }Expand description
An HttpTransport that serves canned responses in order and records
every request.
Use it to run a real provider adapter (request encoding, error
classification, SSE decoding) against recorded wire data without a
server: in unit tests, on wasm32, or to replay a captured exchange.
When the queue runs out, requests fail with a
Connect error.
Clone is cheap and clones share the queue and the recorded requests.
Implementations§
Source§impl ReplayTransport
impl ReplayTransport
Sourcepub fn new(responses: impl IntoIterator<Item = ReplayResponse>) -> Self
pub fn new(responses: impl IntoIterator<Item = ReplayResponse>) -> Self
A transport serving responses in order.
Sourcepub fn push(&self, response: ReplayResponse)
pub fn push(&self, response: ReplayResponse)
Queue another response.
Sourcepub fn requests(&self) -> Vec<HttpRequest>
pub fn requests(&self) -> Vec<HttpRequest>
The requests sent so far, in order.
Trait Implementations§
Source§impl Clone for ReplayTransport
impl Clone for ReplayTransport
Source§impl Debug for ReplayTransport
impl Debug for ReplayTransport
Source§impl Default for ReplayTransport
impl Default for ReplayTransport
Source§impl HttpTransport for ReplayTransport
impl HttpTransport for ReplayTransport
Source§fn send(&self, request: HttpRequest) -> SendFuture<'_>
fn send(&self, request: HttpRequest) -> SendFuture<'_>
Send
request.Auto Trait Implementations§
impl Freeze for ReplayTransport
impl RefUnwindSafe for ReplayTransport
impl Send for ReplayTransport
impl Sync for ReplayTransport
impl Unpin for ReplayTransport
impl UnsafeUnpin for ReplayTransport
impl UnwindSafe for ReplayTransport
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