sideshowcoder / canned

Server to respond with fake API responses, by using a directory of files for finding out what to say!
213 stars 46 forks source link

Ability to specify a delayed response #102

Open robertbird opened 8 years ago

robertbird commented 8 years ago

Hi there,

This looks like a great mocking framework and exactly what I need for testing, so thanks for putting in all the hard work and sharing this! However I am looking to be able to simulate quite slow services with latency etc. So it would be a really great feature to be able to add a comment to set a delay

i.e. for 2000ms delay //! delay: 2000

I know the obvious answer is to have a look myself and submit a pull request. So I will try if I get a chance, but I am new to node, so not sure if in reality I will or not. So just thought I would raise the suggestion.

Any tips on a starting point to implement this would also be great! :)

Cheers, Rob

sideshowcoder commented 8 years ago

Thanks for the feedback, and glad you find it helpful. I think this would be a great thing to support indeed, in the meantime you can probably achieve this quickly now by doing something like

https://github.com/flesler/connect-pause/blob/master/index.js