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

fix: force gzip when no accept encoding header is sent and use identity if gzip is not sent #28026

Merged
merged 14 commits into from
Oct 17, 2023

Conversation

ryanthemanuel
Copy link
Collaborator

@ryanthemanuel ryanthemanuel commented Oct 10, 2023

Additional details

Currently, Cypress tries to filter down Accept-Encoding headers to just gzip. This works when the header is present, but when it is blank according to the standards for the header:

If no Accept-Encoding header field is in the request, any content coding is considered acceptable by the user agent.

Thus, we need to update the logic to specify identity when there is no Accept Encoding header.

The problem would manifest itself in the following scenario:

  1. No Accept-Encoding header is sent on a request
  2. The server sends back the response encoded in an unsupported encoding (e.g. brotli/deflate)
  3. Something in Cypress relies on the decompressed body (this could include cy.intercept or CSS, font, and image assets in Test Replay)

Steps to test

  1. Set up a server that returns brotli encoded assets when no Accept Encoding header is specified.
  2. Record a Cypress run where assets don't request an Accept Encoding.
  3. Ensure that Test Replay is still functional

How has the user experience changed?

n/a

PR Tasks

@cypress
Copy link

cypress bot commented Oct 10, 2023

34 flaky tests on run #51660 ↗︎

0 28144 1345 0 Flakiness 34

Details:

Merge branch 'develop' into ryanm/fix/issue-with-brotli-and-deflate
Project: cypress Commit: 04a6eed88d
Status: Passed Duration: 18:40 💡
Started: Oct 16, 2023 8:00 PM Ended: Oct 16, 2023 8:19 PM
Flakiness  commands/net_stubbing.cy.ts • 2 flaky tests • 5x-driver-firefox

View Output Video

Test Artifacts
network stubbing > intercepting request > can delay with deprecated delayMs param Output
network stubbing > intercepting request > delay works correctly with 204 No Content Output
Flakiness  e2e/origin/commands/assertions.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
cy.origin assertions > #consoleProps > .should() and .and() Output
Flakiness  cypress/cypress.cy.js • 3 flaky tests • 5x-driver-firefox

View Output Video

Test Artifacts
... > correctly returns currentRetry Output
... > correctly returns currentRetry Output
... > correctly returns currentRetry Output
Flakiness  runs.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
... > opens the run page if a run is clicked Test Replay Output Screenshots
Flakiness  scaffold-component-testing.cy.ts • 1 flaky test • launchpad-e2e

View Output Video

Test Artifacts
scaffolding component testing > create-react-app > scaffolds component testing for Create React App v5 project Test Replay Output Screenshots

The first 5 flaky specs are shown, see all 20 specs in Cypress Cloud.

Review all test suite changes for PR #28026 ↗︎

ryanthemanuel and others added 2 commits October 11, 2023 10:06
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
@ryanthemanuel ryanthemanuel changed the title fix: only allow identity encoding when accept encoding is not present in requests fix: force gzip when no accept encoding header is sent and use identity if gzip is not sent Oct 14, 2023
cli/CHANGELOG.md Outdated Show resolved Hide resolved
cli/CHANGELOG.md Outdated Show resolved Hide resolved
@ryanthemanuel ryanthemanuel merged commit ca6d30d into develop Oct 17, 2023
80 of 82 checks passed
@ryanthemanuel ryanthemanuel deleted the ryanm/fix/issue-with-brotli-and-deflate branch October 17, 2023 18:52
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 18, 2023

Released in 13.3.2.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.3.2, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure that deflate/brotli is filtered out in Accept Encoding by the Cypress proxy
3 participants