msw 2.2.12 → 2.2.13
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/lib/browser/index.js +12 -9
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +12 -9
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/getResponse.js +2 -2
- package/lib/core/getResponse.js.map +1 -1
- package/lib/core/getResponse.mjs +2 -2
- package/lib/core/getResponse.mjs.map +1 -1
- package/lib/iife/index.js +13 -15
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +2 -2
- package/src/core/getResponse.ts +2 -2
- package/src/core/handlers/GraphQLHandler.test.ts +4 -5
- package/src/core/handlers/HttpHandler.test.ts +5 -5
- package/src/core/utils/handleRequest.test.ts +14 -14
- package/lib/core/utils/internal/randomId.d.mts +0 -3
- package/lib/core/utils/internal/randomId.d.ts +0 -3
- package/lib/core/utils/internal/randomId.js +0 -27
- package/lib/core/utils/internal/randomId.js.map +0 -1
- package/lib/core/utils/internal/randomId.mjs +0 -7
- package/lib/core/utils/internal/randomId.mjs.map +0 -1
- package/src/core/utils/internal/randomId.ts +0 -3
package/lib/browser/index.mjs
CHANGED
|
@@ -370,7 +370,7 @@ You can also automate this process and make the worker script update automatical
|
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.26.
|
|
373
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
|
|
374
374
|
var encoder = new TextEncoder();
|
|
375
375
|
function encodeBuffer(text) {
|
|
376
376
|
return encoder.encode(text);
|
|
@@ -396,7 +396,7 @@ function isResponseWithoutBody(status) {
|
|
|
396
396
|
return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.26.
|
|
399
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-HAGW22AN.mjs
|
|
400
400
|
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
|
401
401
|
|
|
402
402
|
// node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
|
|
@@ -836,7 +836,7 @@ var _Emitter = class {
|
|
|
836
836
|
var Emitter = _Emitter;
|
|
837
837
|
Emitter.defaultMaxListeners = 10;
|
|
838
838
|
|
|
839
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.26.
|
|
839
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs
|
|
840
840
|
var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
|
|
841
841
|
function getGlobalSymbol(symbol) {
|
|
842
842
|
return (
|
|
@@ -980,8 +980,11 @@ var Interceptor = class {
|
|
|
980
980
|
this.logger.info("cleared global instance!", this.symbol.description);
|
|
981
981
|
}
|
|
982
982
|
};
|
|
983
|
+
function createRequestId() {
|
|
984
|
+
return Math.random().toString(16).slice(2);
|
|
985
|
+
}
|
|
983
986
|
|
|
984
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.26.
|
|
987
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/index.mjs
|
|
985
988
|
var BatchInterceptor = class extends Interceptor {
|
|
986
989
|
constructor(options) {
|
|
987
990
|
BatchInterceptor.symbol = Symbol(options.name);
|
|
@@ -1265,7 +1268,7 @@ var DeferredPromise = class extends Promise {
|
|
|
1265
1268
|
}
|
|
1266
1269
|
};
|
|
1267
1270
|
|
|
1268
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.26.
|
|
1271
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-OUWBQF3Z.mjs
|
|
1269
1272
|
var RequestController = class {
|
|
1270
1273
|
constructor(request) {
|
|
1271
1274
|
this.request = request;
|
|
@@ -1303,7 +1306,7 @@ async function emitAsync(emitter, eventName, ...data) {
|
|
|
1303
1306
|
}
|
|
1304
1307
|
}
|
|
1305
1308
|
|
|
1306
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.26.
|
|
1309
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-3FNUI33J.mjs
|
|
1307
1310
|
function isPropertyAccessible(obj, key) {
|
|
1308
1311
|
try {
|
|
1309
1312
|
obj[key];
|
|
@@ -1335,7 +1338,7 @@ var _FetchInterceptor = class extends Interceptor {
|
|
|
1335
1338
|
);
|
|
1336
1339
|
globalThis.fetch = async (input, init) => {
|
|
1337
1340
|
var _a;
|
|
1338
|
-
const requestId =
|
|
1341
|
+
const requestId = createRequestId();
|
|
1339
1342
|
const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input;
|
|
1340
1343
|
const request = new Request(resolvedInput, init);
|
|
1341
1344
|
this.logger.info("[%s] %s", request.method, request.url);
|
|
@@ -1450,7 +1453,7 @@ function createNetworkError(cause) {
|
|
|
1450
1453
|
});
|
|
1451
1454
|
}
|
|
1452
1455
|
|
|
1453
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.26.
|
|
1456
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-VYFS2IF2.mjs
|
|
1454
1457
|
function concatArrayBuffer(left, right) {
|
|
1455
1458
|
const result = new Uint8Array(left.byteLength + right.byteLength);
|
|
1456
1459
|
result.set(left, 0);
|
|
@@ -1644,7 +1647,7 @@ var XMLHttpRequestController = class {
|
|
|
1644
1647
|
this.method = "GET";
|
|
1645
1648
|
this.url = null;
|
|
1646
1649
|
this.events = /* @__PURE__ */ new Map();
|
|
1647
|
-
this.requestId =
|
|
1650
|
+
this.requestId = createRequestId();
|
|
1648
1651
|
this.requestHeaders = new Headers();
|
|
1649
1652
|
this.responseBuffer = new Uint8Array();
|
|
1650
1653
|
this.request = createProxy(initialRequest, {
|