Mocking Configuration
The mocking plugin simulates API responses without forwarding requests to upstream services, offering customization of status codes, response bodies, headers, and more for API testing and development. Configuration covers plugin parameters.
Parameters
See plugin common configurations for configuration options available to all plugins.
delay
Mock response delay in seconds.
response_status
HTTP status code of the mock response.
content_type
Content-Typeheader of the mock response.response_example
Response body of the mock response. Support the use of built-in variables in the body.
At least one of the
response_exampleandresponse_schemashould be configured.response_schema
Response JSON Schema. The JSON schema supports
string,number,integer,boolean,object, andarrayin data types.At least one of the
response_exampleandresponse_schemashould be configured.response_schemais only effective whenresponse_exampleis not configured.with_mock_header
If true, add the response header
x-mock-by. APISIX sets its value toAPISIX/{version}, while API7 Gateway sets it toAPI7/{version}.response_headers
Headers to be added in the mock response.