@replayio-app-building/netlify-recorder 0.58.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -930,8 +930,13 @@ function redactBlobData(blobData) {
|
|
|
930
930
|
responseBody: scrub(call.responseBody)
|
|
931
931
|
})
|
|
932
932
|
);
|
|
933
|
+
const redactedHandlerResponse = blobData.handlerResponse ? {
|
|
934
|
+
...blobData.handlerResponse,
|
|
935
|
+
body: scrub(blobData.handlerResponse.body)
|
|
936
|
+
} : blobData.handlerResponse;
|
|
933
937
|
return {
|
|
934
938
|
...blobData,
|
|
939
|
+
handlerResponse: redactedHandlerResponse,
|
|
935
940
|
requestInfo: redactedRequestInfo,
|
|
936
941
|
capturedData: {
|
|
937
942
|
networkCalls: redactedNetworkCalls,
|
|
@@ -984,7 +989,7 @@ async function finishRequest(requestContext, callbacks, response, options) {
|
|
|
984
989
|
body: typeof response.body === "string" ? response.body : void 0
|
|
985
990
|
},
|
|
986
991
|
originalRequestId: options?.originalRequestId,
|
|
987
|
-
packageVersion: "0.
|
|
992
|
+
packageVersion: "0.60.0"
|
|
988
993
|
};
|
|
989
994
|
const blobData = redactBlobData(rawBlobData);
|
|
990
995
|
const blobContent = JSON.stringify(blobData);
|
|
@@ -1146,6 +1151,9 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
|
|
|
1146
1151
|
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
1147
1152
|
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
1148
1153
|
};
|
|
1154
|
+
const origDateNow = Date.now;
|
|
1155
|
+
let dateNowCounter = 17e11;
|
|
1156
|
+
Date.now = () => dateNowCounter++;
|
|
1149
1157
|
const cryptoMod = __require("crypto");
|
|
1150
1158
|
const origRandomBytes = cryptoMod.randomBytes;
|
|
1151
1159
|
const origRandomUUID = cryptoMod.randomUUID;
|
|
@@ -1275,6 +1283,10 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
|
|
|
1275
1283
|
async json() {
|
|
1276
1284
|
return JSON.parse(this._body ?? "null");
|
|
1277
1285
|
}
|
|
1286
|
+
async arrayBuffer() {
|
|
1287
|
+
const buf = Buffer.from(this._body ?? "");
|
|
1288
|
+
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
|
|
1289
|
+
}
|
|
1278
1290
|
clone() {
|
|
1279
1291
|
return new RequestShim(this.url, {
|
|
1280
1292
|
method: this.method,
|
|
@@ -1487,7 +1499,7 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
|
|
|
1487
1499
|
result.replayResponse = replayResponse;
|
|
1488
1500
|
result.capturedResponse = blobData.handlerResponse;
|
|
1489
1501
|
const statusMismatch = replayResponse.statusCode !== blobData.handlerResponse.statusCode;
|
|
1490
|
-
const bodyMismatch = replayResponse.body !== blobData.handlerResponse.body;
|
|
1502
|
+
const bodyMismatch = (replayResponse.body || "") !== (blobData.handlerResponse.body || "");
|
|
1491
1503
|
if (statusMismatch || bodyMismatch) {
|
|
1492
1504
|
result.responseMismatch = true;
|
|
1493
1505
|
const details = [];
|
|
@@ -1539,6 +1551,7 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
|
|
|
1539
1551
|
delete g2.__REPLAY_REQUEST_COOKIES__;
|
|
1540
1552
|
delete g2.__REPLAY_REQUEST_HEADERS__;
|
|
1541
1553
|
Math.random = origMathRandom;
|
|
1554
|
+
Date.now = origDateNow;
|
|
1542
1555
|
cryptoMod.randomBytes = origRandomBytes;
|
|
1543
1556
|
if (origRandomUUID) cryptoMod.randomUUID = origRandomUUID;
|
|
1544
1557
|
networkHandle.restore();
|