pub struct MockServerConfig {
pub port: u16,
pub host: String,
pub openapi_spec: Value,
pub generator_config: MockGeneratorConfig,
pub enable_cors: bool,
pub response_delays: HashMap<String, u64>,
pub log_requests: bool,
}Expand description
Configuration for the mock server
Fields§
§port: u16Port to run the server on
host: StringHost to bind to
openapi_spec: ValueOpenAPI specification
generator_config: MockGeneratorConfigMock data generator configuration
enable_cors: boolWhether to enable CORS
response_delays: HashMap<String, u64>Custom response delays (in milliseconds)
log_requests: boolWhether to log all requests
Implementations§
Source§impl MockServerConfig
impl MockServerConfig
Sourcepub fn generator_config(self, config: MockGeneratorConfig) -> Self
pub fn generator_config(self, config: MockGeneratorConfig) -> Self
Set the generator configuration
Sourcepub fn enable_cors(self, enabled: bool) -> Self
pub fn enable_cors(self, enabled: bool) -> Self
Enable or disable CORS
Sourcepub fn response_delay(self, endpoint: String, delay_ms: u64) -> Self
pub fn response_delay(self, endpoint: String, delay_ms: u64) -> Self
Add a response delay for a specific endpoint
Sourcepub fn log_requests(self, enabled: bool) -> Self
pub fn log_requests(self, enabled: bool) -> Self
Enable or disable request logging
Trait Implementations§
Source§impl Clone for MockServerConfig
impl Clone for MockServerConfig
Source§fn clone(&self) -> MockServerConfig
fn clone(&self) -> MockServerConfig
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 MockServerConfig
impl Debug for MockServerConfig
Auto Trait Implementations§
impl Freeze for MockServerConfig
impl RefUnwindSafe for MockServerConfig
impl Send for MockServerConfig
impl Sync for MockServerConfig
impl Unpin for MockServerConfig
impl UnwindSafe for MockServerConfig
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