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

Feature request: Support for delayed response #39

Open
m-o-e opened this issue Dec 30, 2019 · 0 comments
Open

Feature request: Support for delayed response #39

m-o-e opened this issue Dec 30, 2019 · 0 comments

Comments

@m-o-e
Copy link

m-o-e commented Dec 30, 2019

First off thanks for this very useful shard! 🙇

Would it be possible add the option to sneak in
a sleep before the stubbed response is returned?

I'm thinking along the lines of:

WebMock.stub(:post, "www.example.com/foo").
  with(body: "abc", headers: {"Content-Type" => "text/plain"}).
  to_return(status: 500, body: "oops", headers: {"X-Error" => "true"})
  .after(2.seconds) # 👈 

This would make it easy to exercise timeout conditions and concurrency scenarios
which are otherwise notoriously hard to test - and a common source of bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant