pub struct RecordingBackend { /* private fields */ }Expand description
Wraps an HttpBackend and records each executed request.
Implementations§
Source§impl RecordingBackend
impl RecordingBackend
Sourcepub fn new(inner: Arc<dyn HttpBackend>) -> RecordingBackend
pub fn new(inner: Arc<dyn HttpBackend>) -> RecordingBackend
Wraps inner and starts with empty recording state.
Sourcepub fn last_recorded(&self) -> Option<RecordedRequest>
pub fn last_recorded(&self) -> Option<RecordedRequest>
Returns the most recent recorded request snapshot.
Sourcepub fn last_request(&self) -> Option<HttpRequest>
pub fn last_request(&self) -> Option<HttpRequest>
Returns a clone of the most recent HttpRequest passed to the backend.
Note: HttpBody::Stream is cloned as HttpBody::Empty — use Self::last_recorded
to assert streaming uploads.
Sourcepub fn take_last_recorded(&self) -> Option<RecordedRequest>
pub fn take_last_recorded(&self) -> Option<RecordedRequest>
Removes and returns the last recorded snapshot.
Sourcepub fn execute_count(&self) -> u32
pub fn execute_count(&self) -> u32
Number of HttpBackend::execute calls.
Sourcepub fn execute_stream_count(&self) -> u32
pub fn execute_stream_count(&self) -> u32
Number of HttpBackend::execute_stream calls.
Sourcepub fn total_calls(&self) -> u32
pub fn total_calls(&self) -> u32
Total transport calls (execute + execute_stream).
Trait Implementations§
Source§impl Clone for RecordingBackend
impl Clone for RecordingBackend
Source§fn clone(&self) -> RecordingBackend
fn clone(&self) -> RecordingBackend
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl HttpBackend for RecordingBackend
impl HttpBackend for RecordingBackend
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
RecordingBackend: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
RecordingBackend: 'async_trait,
Executes one HTTP request and returns the fully buffered response.
Source§fn execute_stream<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpStreamingResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
RecordingBackend: 'async_trait,
fn execute_stream<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpStreamingResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
RecordingBackend: 'async_trait,
Executes one HTTP request and returns a streaming response body.
Auto Trait Implementations§
impl Freeze for RecordingBackend
impl !RefUnwindSafe for RecordingBackend
impl Send for RecordingBackend
impl Sync for RecordingBackend
impl Unpin for RecordingBackend
impl UnsafeUnpin for RecordingBackend
impl !UnwindSafe for RecordingBackend
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