I work with Nightwatch, I need to intercept a query to then inspect its response and get some data from it. The action is triggered by my auto-test, so I just wanna intercept a request, I don't need to send an API request myself or mock a response. I know the HTTP method and request URL, how can I intercept it?
It's not necessary to use nightwatch only, maybe with some libraries it's possible
I want to do something like this
cy.intercept('*', (req) => {
req.headers['Authorization'] = `Token ${Cypress.env('auth')}`;
});
Or like this
cy.intercept('POST', 'api/users').as('register');