mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-12 02:00:06 -06:00
fix: fix loading redirects with TE: chunked (#8896)
This commit is contained in:
@@ -411,6 +411,17 @@ describe('network stubbing', function () {
|
||||
})
|
||||
|
||||
context('network handling', function () {
|
||||
// @see https://github.com/cypress-io/cypress/issues/8497
|
||||
it('can load transfer-encoding: chunked redirects', function () {
|
||||
const url4 = 'http://localhost:3501/fixtures/generic.html'
|
||||
const url3 = `http://localhost:3501/redirect?href=${encodeURIComponent(url4)}`
|
||||
const url2 = `https://localhost:3502/redirect?chunked=1&href=${encodeURIComponent(url3)}`
|
||||
const url1 = `https://localhost:3502/redirect?chunked=1&href=${encodeURIComponent(url2)}`
|
||||
|
||||
cy.visit(url1)
|
||||
.location('href').should('eq', url4)
|
||||
})
|
||||
|
||||
context('can intercept against any domain', function () {
|
||||
beforeEach(function () {
|
||||
// reset origin
|
||||
|
||||
@@ -42,7 +42,14 @@ const createApp = (port) => {
|
||||
})
|
||||
|
||||
app.get('/redirect', (req, res) => {
|
||||
res.redirect(301, req.query.href)
|
||||
if (req.query.chunked) {
|
||||
res.setHeader('transfer-encoding', 'chunked')
|
||||
res.removeHeader('content-length')
|
||||
}
|
||||
|
||||
res.statusCode = 301
|
||||
res.setHeader('Location', req.query.href)
|
||||
res.end()
|
||||
})
|
||||
|
||||
// allows us to serve the testrunner into an iframe for testing
|
||||
|
||||
@@ -299,6 +299,7 @@ const OmitProblematicHeaders: ResponseMiddleware = function () {
|
||||
'set-cookie',
|
||||
'x-frame-options',
|
||||
'content-length',
|
||||
'transfer-encoding',
|
||||
'content-security-policy',
|
||||
'content-security-policy-report-only',
|
||||
'connection',
|
||||
|
||||
Reference in New Issue
Block a user