pub struct Recorder { /* private fields */ }
Expand description
Recorder for capturing API requests and responses
Implementations§
Source§impl Recorder
impl Recorder
Sourcepub fn new(db: RecorderDatabase) -> Self
pub fn new(db: RecorderDatabase) -> Self
Create a new recorder
Sourcepub async fn is_enabled(&self) -> bool
pub async fn is_enabled(&self) -> bool
Check if recording is enabled
Sourcepub async fn record_request(&self, request: RecordedRequest) -> Result<String>
pub async fn record_request(&self, request: RecordedRequest) -> Result<String>
Record a request
Sourcepub async fn record_response(&self, response: RecordedResponse) -> Result<()>
pub async fn record_response(&self, response: RecordedResponse) -> Result<()>
Record a response
Sourcepub async fn record_http_request(
&self,
method: &str,
path: &str,
query_params: Option<&str>,
headers: &HashMap<String, String>,
body: Option<&[u8]>,
context: &RequestContext,
) -> Result<String>
pub async fn record_http_request( &self, method: &str, path: &str, query_params: Option<&str>, headers: &HashMap<String, String>, body: Option<&[u8]>, context: &RequestContext, ) -> Result<String>
Record an HTTP request
Sourcepub async fn record_http_response(
&self,
request_id: &str,
status_code: i32,
headers: &HashMap<String, String>,
body: Option<&[u8]>,
duration_ms: i64,
) -> Result<()>
pub async fn record_http_response( &self, request_id: &str, status_code: i32, headers: &HashMap<String, String>, body: Option<&[u8]>, duration_ms: i64, ) -> Result<()>
Record an HTTP response
Sourcepub fn database(&self) -> &Arc<RecorderDatabase>
pub fn database(&self) -> &Arc<RecorderDatabase>
Get database reference
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Recorder
impl !RefUnwindSafe for Recorder
impl Send for Recorder
impl Sync for Recorder
impl Unpin for Recorder
impl !UnwindSafe for Recorder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more