Behavioral headers allow you to change the behavior of the Mocking plugin for the individual request without changing the configuration.
The X-Kong-Mocking-Delay
header tells the plugin how many milliseconds to delay before responding. The delay value must be between 0
(inclusive) and 10000
(inclusive), otherwise it returns a 400
error like this:
The X-Kong-Mocking-Example-Id
header tells the plugin which response example is used when the endpoint has multiple examples for a single status code.
OpenAPI 3.0 allows you to define multiple examples in a single MIME type. The following example has two candidate examples: User1 and User2.
paths:
/query_user:
get:
responses:
'200':
description: A user object.
content:
application/json:
examples:
User1:
value:
id: 10
name: User1
User2:
value:
id: 20
name: User2
By default, the plugin chooses the minimum status code that is defined in the corresponding method.
The X-Kong-Mocking-Status-Code
header allows requests to change the default status code selection behavior by specifying a status code that is defined in the corresponding method.