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

Possibility: simulated / replayed requests for testing client code #3

Open
yurkobb opened this issue Jun 16, 2020 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@yurkobb
Copy link

yurkobb commented Jun 16, 2020

First of all, thank you for bringing this wonderful package to life.

Now, there's one use case that I don't currently see covered - a way to have something custom "in-between" the API and the network, something that could, for instance:

  1. Record a response in some predefined local storage in addition to returning it, and then replay the response for any request that is identical. This could be used to build something like python's betamax package.
  2. Provide ways to simulate the responses in some other way, maybe by defining one's own "replacement" response-generating callbacks.
  3. Provide ways to inspect the request(s), in addition to 1 and/or 2.

Such functionality could be useful if it could happen invisibly to the calling code, so that one could reproducibly test client code that is performing HTTP requests with real response data, but without actually talking to the network.

With the request package this can be achieved by using the parametrized API, where a requester can be swapped in by the with-requester form. I'm relying on this to test with recorded responses in my little (newbie) racket project.

So this is my humble feature suggestion, although I'm not sure if I'm missing something obvious that would make all of this unnecessary to achieve the described goals.

@yurkobb yurkobb changed the title Possiblity: simulated / replayed requests for testing client code Possibility: simulated / replayed requests for testing client code Jun 16, 2020
@Bogdanp Bogdanp added the enhancement New feature or request label Jun 18, 2020
@Bogdanp
Copy link
Owner

Bogdanp commented Jun 18, 2020

Thanks! I think it would be useful to provide hooks so that something like what you describe can be built on top of the library, but I'll have to think about how to do it.

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

No branches or pull requests

2 participants