Skip to main content

Module wire

Module wire 

Source
Expand description

Mountebank wire-shape tolerance, shared across crates (issue #936).

Mountebank accepts several spellings of the same value — a status code as a number or a numeric string, a header as one value or an array, a header value as any JSON scalar. Those rules are a property of the wire format, not of any one subsystem, so they live here rather than inside the imposter types: the imposter stub path and the intercept rule schema both parse the same JSON and must agree about what it means. They previously lived in rift-mock-core as pub(crate), which is exactly why the intercept path drifted (issue #933 for body, this issue for statusCode/headers).

Modules§

multi_value_headers
Serde for multi-value headers (issue #238). Accepts the Mountebank-style "k": "v" and "k": ["v1", "v2"] on the wire; serializes a single value back as a plain string and multiple values as an array, so existing single-value consumers are unaffected.
single_value_headers
Serde for header objects that hold one value per name (issue #1050) — proxy.injectHeaders and _rift.fault.error.headers.

Functions§

deserialize_optional_status_code
Deserialize an optional top-level statusCode (flat response form, issue #304), reusing the number-or-string parsing. Only invoked when the field is present; a null is treated as absent (None) so a stray null on a non-flat response stays accepted as before.
deserialize_status_code
Deserialize statusCode from either a number or a string