aneilbaboo / replayer

Replay HTTP requests for testing Node.js / Javascript code
Apache License 2.0
33 stars 7 forks source link

proposal for repeated identical requests #27

Open derhuerst opened 3 years ago

derhuerst commented 3 years ago

If the same request returns different data during different invocations, replayer has no way of differentiating between the two invocations. This can happen when, for example, a resources is fetched using a GET request, it is modified using a PUT request, and it is fetched once more using a GET request to verify that it was updated successfully.

One could add an option to replayer that enumerates the identical requests: It would count how often each request hash has occurred and store fixtures including their number.

As an example, let's assume that GET /foo's hash is abc123 and PATCH /foo … isdef456`, and we do three requests:

  1. GET /foo
  2. PATCH /foo …
  3. GET /foo

There would now be three fixtures:

Of course, this wouldn't work in every use case, but AFAICT it solves all basic "read, modify, read again" use cases.

derhuerst commented 2 years ago

@aneilbaboo sorry for bothering you! do you have an opinion on this? would you accept a PR for this?

derhuerst commented 1 year ago

any news on this?