POST request not working in Cypress plugin

Viewed 245

I want to do a POST request after Cypress has been run:

module.exports = (on, config) => {
  on('after:run', (results) => {
    console.log('Failed tests: ', results.totalFailed)

    fetch('https://status.**.**/api/webhook/cypress-e2e-testing', {
      method: 'POST',
      headers: { Authorization: 'Bearer Hk0WkGZMjckIxpIgSlpSVVe2g2DYibYCKMyV5SBdRYng8Ash****' }
    })
      .then(console.log('fetch'))
  })
}

In the Cypress log I do see the fetch but the POST doesn't seem to work.

The URL for the post is a API end point that, when a POST request is received, set's a 24 hour countdown (it expects a POST request each 24 hours). When I use Postman the countdown is reset to 24 hours again:

enter image description here

But using the fetch in the script nothing seems to happen.

0 Answers
Related