Expand description
Mocking plugin (mocking) — a faithful subset of Apache APISIX’s
mocking plugin: responds with a configured mock instead of proxying
upstream. Useful for stubbing APIs during development and testing.
Terminal wiring: a mocking node always answers the request itself, so
it returns Ok with the mock written onto Context.response — wire its
success port straight to client.in (never to an upstream). The
error port is never taken.
Deviation from APISIX: response_schema (random body generation from a
JSON schema) is not implemented — configs that set it are rejected at
load, so response_example is required.
Structs§
- Mocking
Plugin - Builds a mock response: optional delay, then status + headers + body.
The body and string header values support
$varinterpolation.
Constants§
- SUPPORTED_
CONTENT_ 🔒TYPES - Content types the plugin accepts (matched on the part before
;), mirroring APISIX’ssupport_content_type.
Functions§
- parse_
headers 🔒 - Accepts
response_headersas a map ({name: value}) or as the UI editor’s array form ([{name, value}]); scalar values are stringified, other shapes are rejected. Header names are lowercased.