I have a code where an endpoint(https://localhost:3000/endpoint/A) triggers a method and this method internally calls another endpoint(https://localhost:3000/endpoint/B). So now the headers of second endpoint (https://localhost:3000/endpoint/B) have to be modified as there are some mandatory custom headers.
So i tried using the below code to intercept second endpoint and modify headers but the cypress test is not intercepting this request. Can someone throw some inputs or let me know what is the mistake i am doing here.
cy.intercept('POST', '/endpoint/B', (req) => {
req.headers['custom-header-one'] = "ch1"
req.headers['custom-header-two'] = "ch2"
cy.log(JSON.stringify(req.headers));
})
Edit 1 :
The second call I am doing is a third party endpoint and it happens on the node server.
Removed the http from the code as its not working with or without http