pub struct CapturedRequest {
pub method: String,
pub path: String,
pub query_params: HashMap<String, String>,
pub headers: HashMap<String, String>,
pub body: Option<Value>,
pub status_code: Option<u16>,
pub response_body: Option<Value>,
pub timestamp: DateTime<Utc>,
pub source: String,
pub user_agent: Option<String>,
pub metadata: HashMap<String, Value>,
}Expand description
Captured request for contract analysis
Fields§
§method: StringHTTP method
path: StringRequest path
query_params: HashMap<String, String>Query parameters
headers: HashMap<String, String>Request headers
body: Option<Value>Request body
status_code: Option<u16>Response status code (if available)
response_body: Option<Value>Response body (if available)
timestamp: DateTime<Utc>Timestamp when request was captured
source: StringSource of the capture (browser_extension, proxy, manual_upload, api)
user_agent: Option<String>User agent (if available)
metadata: HashMap<String, Value>Additional metadata
Implementations§
Source§impl CapturedRequest
impl CapturedRequest
Sourcepub fn new(
method: impl Into<String>,
path: impl Into<String>,
source: impl Into<String>,
) -> CapturedRequest
pub fn new( method: impl Into<String>, path: impl Into<String>, source: impl Into<String>, ) -> CapturedRequest
Create a new captured request
Sourcepub fn with_query_params(
self,
params: HashMap<String, String>,
) -> CapturedRequest
pub fn with_query_params( self, params: HashMap<String, String>, ) -> CapturedRequest
Add query parameters
Sourcepub fn with_headers(self, headers: HashMap<String, String>) -> CapturedRequest
pub fn with_headers(self, headers: HashMap<String, String>) -> CapturedRequest
Add headers
Sourcepub fn with_body(self, body: Value) -> CapturedRequest
pub fn with_body(self, body: Value) -> CapturedRequest
Set request body
Sourcepub fn with_response(
self,
status_code: u16,
body: Option<Value>,
) -> CapturedRequest
pub fn with_response( self, status_code: u16, body: Option<Value>, ) -> CapturedRequest
Set response
Trait Implementations§
Source§impl Clone for CapturedRequest
impl Clone for CapturedRequest
Source§fn clone(&self) -> CapturedRequest
fn clone(&self) -> CapturedRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CapturedRequest
impl Debug for CapturedRequest
Source§impl<'de> Deserialize<'de> for CapturedRequest
impl<'de> Deserialize<'de> for CapturedRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CapturedRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CapturedRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for CapturedRequest
impl Serialize for CapturedRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for CapturedRequest
impl RefUnwindSafe for CapturedRequest
impl Send for CapturedRequest
impl Sync for CapturedRequest
impl Unpin for CapturedRequest
impl UnsafeUnpin for CapturedRequest
impl UnwindSafe for CapturedRequest
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