Add a delay option to add latency to the response
joanlopez opened this issue · comments
Context
One of the common benefits of using a mock server is its ability to add latency to its responses in order to simulate network issues. However, that option is not available yet on Killgrave, so it's a really simple but very worthy feature to implement.
Proposed implementation (UPDATE: #32 (comment))
A new field delay
under the response
section (within imposter) can be created and taken into account when returning a response.
The initial implementation can be as simple as posible, for example, assuming the configuration value is always defined in a predefined unit (let's say milliseconds -ms-).
Then, that implementation can be improved in order to allow the user define the value unit (ns, ms, s...) with a predefined format (i.e. 500ms
).
For those interested on doing it directly that "best way", please let us know (here on the issue) what's your proposal (the one mentioned above -500ms
- or some other) to define the delay value and unit.
Maybe delay should be an interval? So, delay will be more non-deterministic value. But I don't know will it be useful in actual testing or not.
Maybe delay should be an interval? So, delay will be more non-deterministic value. But I don't know will it be useful in actual testing or not.
Yes, of course. It does make make a lot of sense. Let's do it that way.