-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix(proxy/prerequests): fix duplicate key behavior, fallthrough #23227
Conversation
Thanks for taking the time to open a PR!
|
function expectPendingCounts (pendingRequests: number, pendingPreRequests: number) { | ||
expect(preRequests.pendingRequests._length()).to.eq(pendingRequests, 'wrong number of pending requests') | ||
expect(preRequests.pendingPreRequests._length()).to.eq(pendingPreRequests, 'wrong number of pending prerequests') | ||
} |
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.
You can run this spec and replace this fn with:
function expectPendingCounts (pendingRequests: number, pendingPreRequests: number) {
expect(Object.entries(preRequests.pendingRequests).length).to.eq(pendingRequests, 'wrong number of pending requests')
expect(Object.entries(preRequests.pendingPreRequests).length).to.eq(pendingPreRequests, 'wrong number of pending prerequests')
}
to see the previous behavior, all 4 tests failed on this assertion with a leak.
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Co-authored-by: Blue F <blue@cypress.io>
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.
I initially left a comment, but I had misunderstood what was going on. I'm pretty clear now. Looks good!
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
User facing changelog
Additional details
cypress/packages/proxy/lib/http/util/prerequests.ts
Lines 69 to 83 in 8fb785a
Record<string, ...>
data structure would clobber any duplicateurl+method
requests/pre-requests, which could manifest itself in incorrect pre-request data or unintended delays of requests by 500ms.StackMap
which supports duplicate keys and.pop
by key.Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?