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 neo355/grafana#2

Comments

@flotwig
Copy link
Member

@flotwig 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

This comment has been minimized.

Copy link

@cypress-bot 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

This comment has been minimized.

Copy link

@cypress-bot 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.
Projects
None yet
2 participants
You can’t perform that action at this time.