Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay/Lag/Sleep for requests #12

Closed
andreas-mausch opened this issue Oct 6, 2020 · 2 comments
Closed

Delay/Lag/Sleep for requests #12

andreas-mausch opened this issue Oct 6, 2020 · 2 comments
Labels
question Further information is requested

Comments

@andreas-mausch
Copy link

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?

@sinedied
Copy link
Owner

sinedied commented Oct 7, 2020

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: []
};

@sinedied sinedied added the question Further information is requested label Oct 7, 2020
@andreas-mausch
Copy link
Author

Thank you, this works for me.

@sinedied sinedied closed this as completed Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants