Randomised Responses
The behavior of production APIs in real-world scenarios is all but reliable. Due to various constraints (like network congestion, bad request from client side or even sometimes server failures), your back-end APIs might behave in different ways, producing different responses.
In the Dynamic Responses section, we learned that you can add the possible outcome of an API to the Mocklets dashboard. But what if you want your API to return one of the responses randomly instead of the currently active response?
Generating random responses from the API on every request gives a true sense of working with a real-world API.
How to make an API to return random responses
It's very simple to set your API to return random responses on every request. Just enable Randomised Responses settings of your API, and your API will starting one the response set in your api on a random basis. If enabled, this setting will override the active response.
Please note If you have enabled the Use Api as Proxy, this feature will be overridden and you will receive the response sent by your proxy server.
Last updated