Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Support non-deterministic order of HTTP requests. #10

Open
ianwsperber opened this issue Nov 2, 2018 · 1 comment
Open

Support non-deterministic order of HTTP requests. #10

ianwsperber opened this issue Nov 2, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ianwsperber
Copy link
Contributor

Currently the order of the mocks must match the order of the HTTP requests. However some applications will have a non-deterministic order of HTTP requests. We could support these apps by:

  1. Support providing a callback to match an HTTP request to a mock
  2. Support matching HTTP to a mock by URL, ignoring order (could be configurable).

Would be great to get feedback on usage before making a decision.

@kevinmstephens
Copy link

@ianwsperber The request to match by URL is pretty straightforward to implement. And I think the use-case that supports is:

  • I have a server that makes calls A, B, C. The order of B, C calls is non-deterministic.
  • I want to run save to capture mocks to disk. I want to run load to restore mocks from disk.
  • I don't want my tests to fail if the order of B and C tests fail

However using the matching...respond feature one could inline the mocks for B and C. They wouldn't get the benefit of easily saving and loading B and C calls but that would work too.

Any thoughts on if matching...respond will meet the need or is the use case more along the lines of save...load mocks?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants