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
Record identical requests #379
Conversation
…ette to playback and record request/responses at a given index. Do not require Cassette to manage index state.
… the recording index.
…y exists in the cassette.
… no index keys playback.
…ed cassettes playback multiple identical requests correctly.
…is called as part of eject() and insertCassette().
(with and without legacy entries)
…te have to handle legacy entries Because the Videorecorder increments the index for each identical requests it also passes it to the cassette, so the cassette have to handle legacy stored entries. So if no index is present while loading recorded requests we have to set the index to searched one (instead of zero) to always match (disabled the feature), when all other matchers match.
This reverts commit ce1471b.
|
||
protected function iterateIndex(Request $request): int | ||
{ | ||
$hash = $request->getHash(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with this method is that it assumes a request is unique based on its hash, but this may not always be the case.
For instance, if someone turns off the header request matcher, requests with the same body, URL, and other parameters but different headers should still be treated as the same request and receive the sequential index.
However, this solution would result in different hashes for those identical requests due to the differing headers, and both would get the same index.
I hope this is clear enough.
Would you accept PR or does this help you to resolve it?
Context
This PR is the rebased result of #270 and small fixes and is hopefully the last try to bring this feature back to the
master
. There is nothing more to say, for more information see #161 (which inspired #270) or the issue #132.What has been done
TODO