Home > Software design >  Cypress how to use api key in put/post request?
Cypress how to use api key in put/post request?

Time:02-11

I am trying to use AWS API and its API-key in POST/PUT call in Cypress, couldn't find enough details, can someone please help?

CodePudding user response:

There are few options you can try, Here is one :

cy.intercept('POST', '/users*', (req) => {
  req.headers['x-api-key'] = 'bearer my-bearer-auth-token'
}).as('addAuthHeader')

Refer Offical Link here: https://docs.cypress.io/guides/guides/network-requests#Assertions

CodePudding user response:

I was able to resovle it syntax is: authorization : key value no quotes –

  • Related