pub struct ResponseConfig {
pub status: u16,
pub headers: HashMap<String, String>,
pub body: Option<Value>,
pub delay: Option<Duration>,
pub close_connection: bool,
}Expand description
How a matched request should be answered.
Fields§
§status: u16HTTP status code. Defaults to 200.
headers: HashMap<String, String>Response headers.
body: Option<Value>Response body. Rendered as JSON.
May contain template expressions such as {{path.id}} (see the
template module).
delay: Option<Duration>Optional artificial delay before the response is sent.
Parsed from human-friendly durations, e.g. 2s, 250ms, 1m 30s.
close_connection: boolWhen true, the server signals that the connection should be closed
after the response (by sending the Connection: close header).
Trait Implementations§
Source§impl Clone for ResponseConfig
impl Clone for ResponseConfig
Source§fn clone(&self) -> ResponseConfig
fn clone(&self) -> ResponseConfig
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 Debug for ResponseConfig
impl Debug for ResponseConfig
Source§impl Default for ResponseConfig
impl Default for ResponseConfig
Source§impl<'de> Deserialize<'de> for ResponseConfig
impl<'de> Deserialize<'de> for ResponseConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for ResponseConfig
impl JsonSchema for ResponseConfig
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ResponseConfig
impl PartialEq for ResponseConfig
Source§fn eq(&self, other: &ResponseConfig) -> bool
fn eq(&self, other: &ResponseConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ResponseConfig
impl Serialize for ResponseConfig
impl StructuralPartialEq for ResponseConfig
Auto Trait Implementations§
impl Freeze for ResponseConfig
impl RefUnwindSafe for ResponseConfig
impl Send for ResponseConfig
impl Sync for ResponseConfig
impl Unpin for ResponseConfig
impl UnsafeUnpin for ResponseConfig
impl UnwindSafe for ResponseConfig
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