sinedied/smoke

Delay/Lag/Sleep for requests

Closed this issue · 2 comments

Thanks for the project. I'm currently trying to use it as alternative to namshi/mockserver and like it much better. :)

The only thing missing for me is the Response-Delay, which is useful to see if loading animations, spinners etc. are shown correctly.

Do you think this can be added?

There's currently no built-in option for that, but you can easily add it using hooks

Something like this should do the trick:

const delay = 1000; // in ms

function addDelay(req, res, next) {
  setTimeout(next, delay);
}

module.exports = {
  before: [addDelay],
  after: []
};

Thank you, this works for me.