We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c03a36a commit 475b19aCopy full SHA for 475b19a
cypress/support/commands.js
@@ -44,6 +44,11 @@ Cypress.Commands.add('getCSRFToken', () => {
44
return cy.request('GET', 'http://localhost:8080/api/v1/repo').then((res) => {
45
const cookies = res.headers['set-cookie'];
46
const csrfCookie = cookies.find(c => c.startsWith('csrf='));
47
+
48
+ if (!csrfCookie) {
49
+ throw new Error('No CSRF cookie found');
50
+ }
51
52
const token = decodeURIComponent(csrfCookie.split('=')[1].split(';')[0]);
53
return cy.wrap(token);
54
});
0 commit comments