From 3198a1eeefb4296bbc8200194e8f8c82791ae11b Mon Sep 17 00:00:00 2001 From: Lukas Siemon Date: Fri, 15 Dec 2023 09:44:30 -0800 Subject: [PATCH] fix: no longer rewriting body unnecessarily --- src/modules/request-recorder.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/request-recorder.js b/src/modules/request-recorder.js index 2732c3b1..c30d7485 100644 --- a/src/modules/request-recorder.js +++ b/src/modules/request-recorder.js @@ -179,7 +179,10 @@ export default (opts) => { if (anyFlagPresent(['magic', 'body'])) { const idx = pendingMocks.findIndex((m) => m.idx === scopeIdx); const requestBody = tryParseJson(body); - pendingMocks[idx].record.body = nullAsString(requestBody); + const requestBodyStr = nullAsString(requestBody); + if (!isEqual(scope.body, requestBodyStr)) { + pendingMocks[idx].record.body = requestBodyStr; + } return scope.body; } return body;