Current behavior
Considering a simple:
And the HTTP response below:
HTTP/1.1 302 Found
Host: 127.0.0.1:8080
Date: Sun, 08 Jan 2023 16:07:27 GMT
Connection: close
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: SESSION_ID=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0
Set-Cookie: SESSION_ID=new_cookie_value
Location: next-url
Content-type: text/html; charset=UTF-8
Notice the Set-Cookie, first removing a cookie, then recreating it, and the presence of the Location header
When Cypress goes to the redirected URL, the cookie is lost.
If I remove the Location header from the response and redirect manually with another cy.visit('/next-url'); OR if I drop the first Set-Cookie header (the one which deletes the cookie), then everything works fine.
Desired behavior
I expect Cypress to behave like the browser, which understands the last Set-Cookie should keep/recreate the cookie.
Test code to reproduce
Small sample available above, I might fork the https://github.com/cypress-io/cypress-test-tiny later, but definitely not at this moment.
Cypress Version
12.2.0
Node version
18.11.0
Operating System
Windows 10
Debug Logs
No response
Other
Original report is here: #19800 (comment)
Current behavior
Considering a simple:
And the HTTP response below:
When Cypress goes to the redirected URL, the cookie is lost.
If I remove the
Locationheader from the response and redirect manually with anothercy.visit('/next-url');OR if I drop the firstSet-Cookieheader (the one which deletes the cookie), then everything works fine.Desired behavior
I expect Cypress to behave like the browser, which understands the last
Set-Cookieshould keep/recreate the cookie.Test code to reproduce
Small sample available above, I might fork the https://github.com/cypress-io/cypress-test-tiny later, but definitely not at this moment.
Cypress Version
12.2.0
Node version
18.11.0
Operating System
Windows 10
Debug Logs
No response
Other
Original report is here: #19800 (comment)