-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
topic: cy.intercept()type: unexpected behaviorUser expected result, but got anotherUser expected result, but got another
Description
Current behavior
The request I want to stub looks like so with the old cy.route
cy.route({
method: 'POST',
url: '**/sessions',
status: 200,
response: {
success: true,
},
headers: {
'x-token': "token",
},
})With this, I get the "x-token" returned as a header back to the client. alongside other headers.
connection: "keep-alive"
content-length: "16"
content-type: "application/json; charset=utf-8"
date: "Thu, 11 Feb 2021 12:58:34 GMT"
vary: "Accept-Encoding",
x-token: "token"
Trying out the new cy.intercept API,
cy.intercept('**/sessions', {
body: { success: true },
headers: {
x-token: "token"
},
})This is what I get back
content-type: "application/json"
Desired behavior
I expect the x-token to be part of the headers returned in the response.
If Im missing anything, please let me know, thanks
Test code to reproduce
https://github.com/Tevinthuku/cypress-test-tiny
https://codesandbox.io/s/modest-hofstadter-gl5xj?file=/src/App.js
Versions
Cypress v 6.4.0
lc-leoniefarmer
Metadata
Metadata
Assignees
Labels
topic: cy.intercept()type: unexpected behaviorUser expected result, but got anotherUser expected result, but got another