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

Since 3.5.0, Cookie headers explicitly set on cy.visit or cy.request are ignored #5894

Closed
flotwig opened this issue Dec 5, 2019 · 2 comments · Fixed by #5896 · May be fixed by ngChile/ngx-devkit-cypress-builder#20 or qsays/grafana#1
Assignees
Labels
topic: cookies 🍪 type: regression A bug that didn't appear until a specific Cy version release v3.5.0 🐛 Issue present since 3.5.0

Comments

@flotwig
Copy link
Contributor

flotwig commented Dec 5, 2019

Current behavior:

If the user explicitly supplies a Cookie header in cy.visit or cy.request, it will be overwritten/replaced by the Cookie header set via the browser:

setRequestCookieHeader: (req, reqUrl, automationFn) ->
automationFn('get:cookies', { url: reqUrl })
.then (cookies) ->
debug('got cookies from browser %o', { reqUrl, cookies })
header = cookies.map (cookie) ->
"#{cookie.name}=#{cookie.value}"
.join("; ") || undefined
req.headers.Cookie = header
header

That is, cy.visit({ headers: { Cookie: 'foo' } }) will not send the Cookie header at all, since it is overwritten.

cy.visit({ headers: { cookie: 'foo' } }) will send Cookie and cookie headers, which may cause issues on their backend since there should only be 1 Cookie header.

Desired behavior:

Users can explicitly set Cookie headers in cy.request and cy.visit.

Versions

Cypress >=3.5.0

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 6, 2019

The code for this is done in cypress-io/cypress#5896, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Dec 6, 2019
@jennifer-shehane jennifer-shehane added the v3.5.0 🐛 Issue present since 3.5.0 label Dec 10, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 12, 2019

Released in 3.8.0.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: cookies 🍪 type: regression A bug that didn't appear until a specific Cy version release v3.5.0 🐛 Issue present since 3.5.0
Projects
None yet
2 participants