Skip to content

Commit

Permalink
fix stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ika-x committed May 25, 2021
1 parent e780885 commit 618f737
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,17 @@ module.exports = function autoRecord() {
method,
},
(req) => {
req.reply((res) => {
const newResponse = sortedRoutes[method][url][index];

res.send(
newResponse.status,
newResponse.fixtureId
? {
fixture: `${fixturesFolderSubDirectory}/${newResponse.fixtureId}.json`,
}
: newResponse.response,
newResponse.headers
);
let newResponse = response.response;

This comment has been minimized.

Copy link
@jsweetman

jsweetman Aug 4, 2021

Doesn't this commit cause a bug? newResponse no longer takes into account index, so identical records will always return what's at index 0.

if (response.fixtureId) {
newResponse = {
fixture: `${fixturesFolderSubDirectory}/${newResponse.fixtureId}.json`,
};
}
req.reply(response.status, newResponse, response.headers);

if (sortedRoutes[method][url].length > index + 1) {
index++;
}
});
if (sortedRoutes[method][url].length > index + 1) {
index++;
}
}
);
};
Expand Down

0 comments on commit 618f737

Please sign in to comment.