Configuring your own rate limiters in order to simulate the real thing.
unit
- the time unit the rate is being expressed in e.g. nanoseconds
, seconds
, minutes
rate
- the number of requests per the time unit permitted e.g. 15
burst
- the number of requests that can be made in a burst over the set rate limitPUT
request to https://<your mock API>.wiremockapi.cloud/__admin/ext/settings/extended/rateLimits
containing the JSON object configuring all of your rate limits e.g.
rate-limit
transformer and set the name of the rate limit to be used.
You do this by POST
ing the JSON to https://<your mock API>.wiremockapi.cloud/__admin/mappings
.
Taking the above example, if I wanted to use the “authentication” rate limit in my
login handler stub, I’d do as follows:
rate-limit
element in the transformers
array,
and "rateLimitName": "authentication"
under transformerParameters
.
Once you’ve created a stub this way you will start to see 429 responses when the
request rate to all stubs associated with the named rate limit exceeds the limit.