You are browsing documentation for an outdated plugin version.
Configuration
This plugin is compatible with DB-less mode.
Use the
api_specification
config for DB-less or hybrid mode. The API spec is configured directly in the plugin.
Compatible protocols
The Mocking plugin is compatible with the following protocols:
grpc
, grpcs
, http
, https
Parameters
Here's a list of all the parameters which can be used in this plugin's configuration:
-
string required
The name of the plugin, in this case
mocking
.- If using the Kong Admin API, Konnect API, declarative configuration, or decK files, the field is
name
. - If using the KongPlugin object in Kubernetes, the field is
plugin
.
- If using the Kong Admin API, Konnect API, declarative configuration, or decK files, the field is
-
string
The name or ID of the service the plugin targets. Set one of these parameters if adding the plugin to a service through the top-level
/plugins
endpoint. Not required if using/services/{serviceName|Id}/plugins
. -
string
The name or ID of the route the plugin targets. Set one of these parameters if adding the plugin to a route through the top-level
/plugins
endpoint. Not required if using/routes/{routeName|Id}/plugins
. -
string
The name or ID of the consumer the plugin targets. Set one of these parameters if adding the plugin to a consumer through the top-level
/plugins
endpoint. Not required if using/consumers/{consumerName|Id}/plugins
. -
boolean default:
true
Whether this plugin will be applied.
-
record required
-
string
The path and name of the specification file loaded into Kong Gateway’s database. You cannot use this option for DB-less or hybrid mode.
-
string
The contents of the specification file. You must use this option for hybrid or DB-less mode. With this configuration option, you can include the full specification as part of the configuration, instead of referring to a separate file with
api_specification_filename
that lives next to the Kong Gateway. In Kong Manager, you can copy and paste the contents of the spec directly into theConfig.Api Specification
text field.
-
boolean default:
false
Enables a random delay in the mocked response. Introduces delays to simulate real-time response times by APIs.
-
number default:
1
The maximum value in seconds of delay time. Set this value when
random_delay
is enabled and you want to adjust the default. The value must be greater than themin_delay_time
.
-
number default:
0.001
The minimum value in seconds of delay time. Set this value when
random_delay
is enabled and you want to adjust the default. The value must be less than themax_delay_time
.
-
boolean default:
false
Randomly selects one example and returns it. This parameter requires the spec to have multiple examples configured.
-
array of type
integer
A global list of the HTTP status codes that can only be selected and returned.
-
boolean required default:
false
Determines whether to randomly select an HTTP status code from the responses of the corresponding API method. The default value is
false
, which means the minimum HTTP status code is always selected and returned.
-