pub struct StaticConfig {
pub body: String,
pub raw: bool,
pub metadata: HashMap<String, String>,
}Expand description
Configuration for the static endpoint.
Accepts either a bare string (the response body, JSON-encoded for backward compatibility) or a map for full control:
# bare string -> body is JSON-encoded ("Hello" comes back quoted)
static: "Hello, World!"
# map form -> raw body + custom metadata (HTTP maps metadata to headers)
static:
body: "Hello, World!"
raw: true
metadata:
content-type: "text/plain"
server: "mq-bridge"When raw is true the body is sent verbatim; otherwise it is JSON-encoded as
a string. Every entry in metadata is attached to the produced message; when
this endpoint feeds an HTTP response, those entries become response headers
(e.g. content-type), otherwise they are ordinary message metadata.
Fields§
§body: StringThe static response body.
raw: boolSend the body verbatim instead of JSON-encoding it as a string.
metadata: HashMap<String, String>Extra metadata entries attached to the produced message.
Trait Implementations§
Source§impl Clone for StaticConfig
impl Clone for StaticConfig
Source§fn clone(&self) -> StaticConfig
fn clone(&self) -> StaticConfig
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 StaticConfig
impl Debug for StaticConfig
Source§impl Default for StaticConfig
impl Default for StaticConfig
Source§fn default() -> StaticConfig
fn default() -> StaticConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for StaticConfig
impl<'de> Deserialize<'de> for StaticConfig
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 From<&str> for StaticConfig
impl From<&str> for StaticConfig
Source§impl From<String> for StaticConfig
impl From<String> for StaticConfig
Auto Trait Implementations§
impl Freeze for StaticConfig
impl RefUnwindSafe for StaticConfig
impl Send for StaticConfig
impl Sync for StaticConfig
impl Unpin for StaticConfig
impl UnsafeUnpin for StaticConfig
impl UnwindSafe for StaticConfig
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