Closed ErichSA closed 3 years ago
Can I open a PR? This is the cypress documentation: https://docs.cypress.io/api/commands/intercept#Request-Response-Modification-with-routeHandler
Hello, I got the same problem as initially described despite using the latest 3.1.2 version. The signature for res.send is different if we want to reply with either the direct response or a fixture.
If if modify the code to this, then it works:
req.reply((res) => {
const newResponse = sortedRoutes[method][url][index];
if (newResponse.fixtureId) {
res.send(
{
fixture: `${fixturesFolderSubDirectory}/${newResponse.fixtureId}.json`,
headers: newResponse.headers,
statusCode: newResponse.status
}
);
} else {
res.send(
newResponse.status,
newResponse.response,
newResponse.headers,
);
}
Thanks.
Cypress is not returning the fixture index.js line 169: req.reply(response.status, newResponse, response.headers); It's returning the fixture folder instead. Changing it to:
Everything works.