accessing cookie.value in Cypress.Commands.overwrite('request', ... #20637
Unanswered
mekalag
asked this question in
Questions and Help
Replies: 1 comment
-
Please close this issue, I have fixed it already |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello All,
I have written custom
Cypress.Commands.overwrite('request', (originalFn, ...args) => {
setting 'X-XSRF-TOKEN': cookie.value, does not work.
Throws Error:
TypeError: cookie is null
Whereas if I first set 'X-XSRF-TOKEN': cookie, and run once it throws valid 401 error. Later I change it to 'X-XSRF-TOKEN': cookie.value, it works fine.
But if I close and reopen browser, then back to same issue.
I want to make this work, because for every cy.request we make we have to insert additional header for security purpose. But it's not working as expected. Kindly help
here is a sample project, to reproduce the issue I mentioned
https://github.com/mekalag/cypressProj
test.js is a spec file
which you can run. Kindly help me here stuck for a week or so :(Beta Was this translation helpful? Give feedback.
All reactions