cypress-autorecord
cypress-autorecord copied to clipboard
Abnormal response when using fixtureId
Hello, (I repost it in a new issue rather than the old one #54)
When autorecord stubs requests with responses of big size, it returns the path of the fixture in the response to the client (see #54) instead of the real content itself.
I am using autorecord 3.1.2 + Cypress 8.3.1. 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.
@MasterATM would you mind to create a PR out of this? I'm experiencing the same issue, and your suggestion does indeed solve it for me locally.