Cypress · Middle · Question 36 of 77

How do you call an API with auth in cy.request?

Show the answer

Correct answer: Pass headers or use auth in the options object

Explanation

cy.request({ url, headers: { Authorization: 'Bearer ...' } }). It also sends the browser's cookies for that domain.

Further reading

Problem with a question

Cypress · Middle · question 36

Test yourself

Take the Cypress · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz