pub struct MockRequest {Show 15 fields
pub id: EntityId,
pub name: String,
pub description: Option<String>,
pub method: HttpMethod,
pub path: String,
pub headers: HashMap<String, String>,
pub query_params: HashMap<String, String>,
pub body: Option<String>,
pub response: MockResponse,
pub response_history: Vec<ResponseHistoryEntry>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub tags: Vec<String>,
pub auth: Option<AuthConfig>,
pub priority: i32,
}Will be extracted to mockforge-workspace crate
Expand description
Mock request definition with metadata
Fields§
§id: EntityIdWill be extracted to mockforge-workspace crate
Unique identifier
name: StringWill be extracted to mockforge-workspace crate
Human-readable name
description: Option<String>Will be extracted to mockforge-workspace crate
Optional description
method: HttpMethodWill be extracted to mockforge-workspace crate
HTTP method
path: StringWill be extracted to mockforge-workspace crate
Request path
headers: HashMap<String, String>Will be extracted to mockforge-workspace crate
HTTP headers
query_params: HashMap<String, String>Will be extracted to mockforge-workspace crate
Query parameters
body: Option<String>Will be extracted to mockforge-workspace crate
Request body template
response: MockResponseWill be extracted to mockforge-workspace crate
Expected response
response_history: Vec<ResponseHistoryEntry>Will be extracted to mockforge-workspace crate
History of actual request executions
created_at: DateTime<Utc>Will be extracted to mockforge-workspace crate
Creation timestamp
updated_at: DateTime<Utc>Will be extracted to mockforge-workspace crate
Last modification timestamp
Will be extracted to mockforge-workspace crate
Associated tags
auth: Option<AuthConfig>Will be extracted to mockforge-workspace crate
Authentication configuration
priority: i32Will be extracted to mockforge-workspace crate
Priority for route matching (higher = more specific)
Implementations§
Source§impl MockRequest
impl MockRequest
Sourcepub fn apply_inheritance(
&mut self,
effective_headers: HashMap<String, String>,
effective_auth: Option<&AuthConfig>,
)
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn apply_inheritance( &mut self, effective_headers: HashMap<String, String>, effective_auth: Option<&AuthConfig>, )
Will be extracted to mockforge-workspace crate
Apply inheritance to this request, returning headers and auth from the hierarchy
Sourcepub fn create_inherited_request(
self,
workspace: &Workspace,
folder_path: &[&Folder],
) -> Self
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn create_inherited_request( self, workspace: &Workspace, folder_path: &[&Folder], ) -> Self
Will be extracted to mockforge-workspace crate
Create inherited request with merged headers and auth
Sourcepub fn new(method: HttpMethod, path: String, name: String) -> Self
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn new(method: HttpMethod, path: String, name: String) -> Self
Will be extracted to mockforge-workspace crate
Create a new mock request
Sourcepub fn with_response(self, response: MockResponse) -> Self
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn with_response(self, response: MockResponse) -> Self
Will be extracted to mockforge-workspace crate
Set the response for this request
Sourcepub fn with_header(self, key: String, value: String) -> Self
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn with_header(self, key: String, value: String) -> Self
Will be extracted to mockforge-workspace crate
Add a header
Sourcepub fn with_query_param(self, key: String, value: String) -> Self
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn with_query_param(self, key: String, value: String) -> Self
Will be extracted to mockforge-workspace crate
Add a query parameter
Sourcepub fn with_body(self, body: String) -> Self
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn with_body(self, body: String) -> Self
Will be extracted to mockforge-workspace crate
Set request body
Sourcepub fn with_tag(self, tag: String) -> Self
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn with_tag(self, tag: String) -> Self
Will be extracted to mockforge-workspace crate
Add a tag
Sourcepub fn add_response_history(&mut self, entry: ResponseHistoryEntry)
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn add_response_history(&mut self, entry: ResponseHistoryEntry)
Will be extracted to mockforge-workspace crate
Add a response history entry
Sourcepub fn get_response_history(&self) -> &[ResponseHistoryEntry]
👎Deprecated: Will be extracted to mockforge-workspace crate
pub fn get_response_history(&self) -> &[ResponseHistoryEntry]
Will be extracted to mockforge-workspace crate
Get response history (sorted by execution time, newest first)
Trait Implementations§
Source§impl Clone for MockRequest
impl Clone for MockRequest
Source§fn clone(&self) -> MockRequest
fn clone(&self) -> MockRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MockRequest
impl Debug for MockRequest
Source§impl<'de> Deserialize<'de> for MockRequest
impl<'de> Deserialize<'de> for MockRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for MockRequest
impl RefUnwindSafe for MockRequest
impl Send for MockRequest
impl Sync for MockRequest
impl Unpin for MockRequest
impl UnsafeUnpin for MockRequest
impl UnwindSafe for MockRequest
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
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>
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>
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