iron-session icon indicating copy to clipboard operation
iron-session copied to clipboard

Cypress tests failing: Cypress sanitizes cookies and breaks tests.

Open janhesters opened this issue 3 years ago • 2 comments

The seals generated by this library frequently end with ~2. So when you add a cookie with ~2 in Cypress via cy.setCookie it sanitizes it to \\x7e, which then is not recognized by iron-session's unseal.

It is because of the version delimiter.

const currentMajorVersion = 2;
const versionDelimiter = "~";

Let me know and I can make a PR for this to fix it in this library 🙏

janhesters avatar Dec 01 '21 22:12 janhesters

Hey @janhesters, were you able to figure out a solution? I'm currently on cypress version 9.6.1

ethanbonin avatar May 24 '22 22:05 ethanbonin

@janhesters If you manage to create a new version delimiter while maintaining compatibility with previous versions and while making sure the character is compatible with URLs too (tokens should be able to be used in URLs) then I am all in for a PR 👍

vvo avatar May 25 '22 07:05 vvo