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

Record identical requests #379

Merged
merged 17 commits into from Dec 19, 2022
Merged

Record identical requests #379

merged 17 commits into from Dec 19, 2022

Conversation

higidi
Copy link
Contributor

@higidi higidi commented Dec 19, 2022

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

  • Port this feature back to the 1.5 branch (will be done after merging this)

bwood and others added 17 commits December 19, 2022 15:58
…ette to playback and record request/responses at a given index. Do not require Cassette to manage index state.
…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.
@higidi higidi added the Feature New feature or request label Dec 19, 2022
@higidi higidi self-assigned this Dec 19, 2022
@higidi higidi merged commit 3e8b2b9 into master Dec 19, 2022
@higidi higidi deleted the record_identical_requests branch December 19, 2022 17:25

protected function iterateIndex(Request $request): int
{
$hash = $request->getHash();
Copy link

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?

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

Successfully merging this pull request may close these issues.

None yet

3 participants