Skip to content

Feature request: Support for delayed response #39

@m-o-e

Description

@m-o-e

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions