msw 2.6.1 → 2.6.3
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 +117 -24
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +117 -24
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/utils/handleRequest.d.mts +0 -5
- package/lib/core/utils/handleRequest.d.ts +0 -5
- package/lib/core/utils/handleRequest.js +2 -6
- package/lib/core/utils/handleRequest.js.map +1 -1
- package/lib/core/utils/handleRequest.mjs +2 -6
- package/lib/core/utils/handleRequest.mjs.map +1 -1
- package/lib/core/utils/request/getRequestCookies.js +12 -2
- package/lib/core/utils/request/getRequestCookies.js.map +1 -1
- package/lib/core/utils/request/getRequestCookies.mjs +12 -2
- package/lib/core/utils/request/getRequestCookies.mjs.map +1 -1
- package/lib/iife/index.js +204 -71
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +2 -2
- package/src/core/utils/handleRequest.test.ts +1 -86
- package/src/core/utils/handleRequest.ts +2 -15
- package/src/core/utils/request/getRequestCookies.ts +15 -2
package/lib/iife/index.js
CHANGED
|
@@ -14456,7 +14456,7 @@ ${operationTypes.join("\n")}
|
|
|
14456
14456
|
return stringToRegexp(path, keys, options);
|
|
14457
14457
|
}
|
|
14458
14458
|
|
|
14459
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
14459
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-6HYIRFX2.mjs
|
|
14460
14460
|
var encoder = new TextEncoder();
|
|
14461
14461
|
function encodeBuffer(text) {
|
|
14462
14462
|
return encoder.encode(text);
|
|
@@ -14472,7 +14472,7 @@ ${operationTypes.join("\n")}
|
|
|
14472
14472
|
);
|
|
14473
14473
|
}
|
|
14474
14474
|
|
|
14475
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
14475
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-6MOMO77R.mjs
|
|
14476
14476
|
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
|
14477
14477
|
function isPropertyAccessible(obj, key) {
|
|
14478
14478
|
try {
|
|
@@ -14808,7 +14808,7 @@ ${operationTypes.join("\n")}
|
|
|
14808
14808
|
return message3.toString();
|
|
14809
14809
|
}
|
|
14810
14810
|
|
|
14811
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
14811
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs
|
|
14812
14812
|
var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
|
|
14813
14813
|
function getGlobalSymbol(symbol) {
|
|
14814
14814
|
return (
|
|
@@ -14956,7 +14956,7 @@ ${operationTypes.join("\n")}
|
|
|
14956
14956
|
return Math.random().toString(16).slice(2);
|
|
14957
14957
|
}
|
|
14958
14958
|
|
|
14959
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
14959
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/index.mjs
|
|
14960
14960
|
var BatchInterceptor = class extends Interceptor {
|
|
14961
14961
|
constructor(options) {
|
|
14962
14962
|
BatchInterceptor.symbol = Symbol(options.name);
|
|
@@ -15080,7 +15080,7 @@ ${operationTypes.join("\n")}
|
|
|
15080
15080
|
return urlInstance.origin === location.origin ? urlInstance.pathname : urlInstance.origin + urlInstance.pathname;
|
|
15081
15081
|
}
|
|
15082
15082
|
|
|
15083
|
-
// node_modules/.pnpm/@bundled-es-modules+cookie@2.0.
|
|
15083
|
+
// node_modules/.pnpm/@bundled-es-modules+cookie@2.0.1/node_modules/@bundled-es-modules/cookie/index-esm.js
|
|
15084
15084
|
var __create2 = Object.create;
|
|
15085
15085
|
var __defProp4 = Object.defineProperty;
|
|
15086
15086
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
|
@@ -15112,68 +15112,92 @@ ${operationTypes.join("\n")}
|
|
|
15112
15112
|
exports.parse = parse3;
|
|
15113
15113
|
exports.serialize = serialize;
|
|
15114
15114
|
var __toString = Object.prototype.toString;
|
|
15115
|
-
var
|
|
15116
|
-
|
|
15115
|
+
var __hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
15116
|
+
var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
15117
|
+
var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
|
|
15118
|
+
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
15119
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
15120
|
+
function parse3(str, opt) {
|
|
15117
15121
|
if (typeof str !== "string") {
|
|
15118
15122
|
throw new TypeError("argument str must be a string");
|
|
15119
15123
|
}
|
|
15120
15124
|
var obj = {};
|
|
15121
|
-
var
|
|
15122
|
-
|
|
15125
|
+
var len = str.length;
|
|
15126
|
+
if (len < 2) return obj;
|
|
15127
|
+
var dec = opt && opt.decode || decode;
|
|
15123
15128
|
var index = 0;
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15129
|
+
var eqIdx = 0;
|
|
15130
|
+
var endIdx = 0;
|
|
15131
|
+
do {
|
|
15132
|
+
eqIdx = str.indexOf("=", index);
|
|
15133
|
+
if (eqIdx === -1) break;
|
|
15134
|
+
endIdx = str.indexOf(";", index);
|
|
15130
15135
|
if (endIdx === -1) {
|
|
15131
|
-
endIdx =
|
|
15132
|
-
} else if (
|
|
15136
|
+
endIdx = len;
|
|
15137
|
+
} else if (eqIdx > endIdx) {
|
|
15133
15138
|
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
15134
15139
|
continue;
|
|
15135
15140
|
}
|
|
15136
|
-
var
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
+
var keyStartIdx = startIndex(str, index, eqIdx);
|
|
15142
|
+
var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
15143
|
+
var key = str.slice(keyStartIdx, keyEndIdx);
|
|
15144
|
+
if (!__hasOwnProperty.call(obj, key)) {
|
|
15145
|
+
var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
15146
|
+
var valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
15147
|
+
if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
|
|
15148
|
+
valStartIdx++;
|
|
15149
|
+
valEndIdx--;
|
|
15141
15150
|
}
|
|
15151
|
+
var val = str.slice(valStartIdx, valEndIdx);
|
|
15142
15152
|
obj[key] = tryDecode(val, dec);
|
|
15143
15153
|
}
|
|
15144
15154
|
index = endIdx + 1;
|
|
15145
|
-
}
|
|
15155
|
+
} while (index < len);
|
|
15146
15156
|
return obj;
|
|
15147
15157
|
}
|
|
15148
|
-
function
|
|
15149
|
-
|
|
15150
|
-
|
|
15158
|
+
function startIndex(str, index, max) {
|
|
15159
|
+
do {
|
|
15160
|
+
var code = str.charCodeAt(index);
|
|
15161
|
+
if (code !== 32 && code !== 9) return index;
|
|
15162
|
+
} while (++index < max);
|
|
15163
|
+
return max;
|
|
15164
|
+
}
|
|
15165
|
+
function endIndex(str, index, min) {
|
|
15166
|
+
while (index > min) {
|
|
15167
|
+
var code = str.charCodeAt(--index);
|
|
15168
|
+
if (code !== 32 && code !== 9) return index + 1;
|
|
15169
|
+
}
|
|
15170
|
+
return min;
|
|
15171
|
+
}
|
|
15172
|
+
function serialize(name, val, opt) {
|
|
15173
|
+
var enc = opt && opt.encode || encodeURIComponent;
|
|
15151
15174
|
if (typeof enc !== "function") {
|
|
15152
15175
|
throw new TypeError("option encode is invalid");
|
|
15153
15176
|
}
|
|
15154
|
-
if (!
|
|
15177
|
+
if (!cookieNameRegExp.test(name)) {
|
|
15155
15178
|
throw new TypeError("argument name is invalid");
|
|
15156
15179
|
}
|
|
15157
15180
|
var value = enc(val);
|
|
15158
|
-
if (
|
|
15181
|
+
if (!cookieValueRegExp.test(value)) {
|
|
15159
15182
|
throw new TypeError("argument val is invalid");
|
|
15160
15183
|
}
|
|
15161
15184
|
var str = name + "=" + value;
|
|
15185
|
+
if (!opt) return str;
|
|
15162
15186
|
if (null != opt.maxAge) {
|
|
15163
|
-
var maxAge = opt.maxAge
|
|
15164
|
-
if (
|
|
15187
|
+
var maxAge = Math.floor(opt.maxAge);
|
|
15188
|
+
if (!isFinite(maxAge)) {
|
|
15165
15189
|
throw new TypeError("option maxAge is invalid");
|
|
15166
15190
|
}
|
|
15167
|
-
str += "; Max-Age=" +
|
|
15191
|
+
str += "; Max-Age=" + maxAge;
|
|
15168
15192
|
}
|
|
15169
15193
|
if (opt.domain) {
|
|
15170
|
-
if (!
|
|
15194
|
+
if (!domainValueRegExp.test(opt.domain)) {
|
|
15171
15195
|
throw new TypeError("option domain is invalid");
|
|
15172
15196
|
}
|
|
15173
15197
|
str += "; Domain=" + opt.domain;
|
|
15174
15198
|
}
|
|
15175
15199
|
if (opt.path) {
|
|
15176
|
-
if (!
|
|
15200
|
+
if (!pathValueRegExp.test(opt.path)) {
|
|
15177
15201
|
throw new TypeError("option path is invalid");
|
|
15178
15202
|
}
|
|
15179
15203
|
str += "; Path=" + opt.path;
|
|
@@ -15191,6 +15215,9 @@ ${operationTypes.join("\n")}
|
|
|
15191
15215
|
if (opt.secure) {
|
|
15192
15216
|
str += "; Secure";
|
|
15193
15217
|
}
|
|
15218
|
+
if (opt.partitioned) {
|
|
15219
|
+
str += "; Partitioned";
|
|
15220
|
+
}
|
|
15194
15221
|
if (opt.priority) {
|
|
15195
15222
|
var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
|
|
15196
15223
|
switch (priority) {
|
|
@@ -15231,11 +15258,8 @@ ${operationTypes.join("\n")}
|
|
|
15231
15258
|
function decode(str) {
|
|
15232
15259
|
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
15233
15260
|
}
|
|
15234
|
-
function encode(val) {
|
|
15235
|
-
return encodeURIComponent(val);
|
|
15236
|
-
}
|
|
15237
15261
|
function isDate(val) {
|
|
15238
|
-
return __toString.call(val) === "[object Date]"
|
|
15262
|
+
return __toString.call(val) === "[object Date]";
|
|
15239
15263
|
}
|
|
15240
15264
|
function tryDecode(str, decode2) {
|
|
15241
15265
|
try {
|
|
@@ -27215,8 +27239,18 @@ ${operationTypes.join("\n")}
|
|
|
27215
27239
|
var cookieStore = new CookieJar(store);
|
|
27216
27240
|
|
|
27217
27241
|
// src/core/utils/request/getRequestCookies.ts
|
|
27242
|
+
function parseCookies(input) {
|
|
27243
|
+
const parsedCookies = source_default2.parse(input);
|
|
27244
|
+
const cookies = {};
|
|
27245
|
+
for (const cookieName in parsedCookies) {
|
|
27246
|
+
if (typeof parsedCookies[cookieName] !== "undefined") {
|
|
27247
|
+
cookies[cookieName] = parsedCookies[cookieName];
|
|
27248
|
+
}
|
|
27249
|
+
}
|
|
27250
|
+
return cookies;
|
|
27251
|
+
}
|
|
27218
27252
|
function getAllDocumentCookies() {
|
|
27219
|
-
return
|
|
27253
|
+
return parseCookies(document.cookie);
|
|
27220
27254
|
}
|
|
27221
27255
|
function getDocumentCookies(request) {
|
|
27222
27256
|
if (typeof document === "undefined" || typeof location === "undefined") {
|
|
@@ -27237,7 +27271,7 @@ ${operationTypes.join("\n")}
|
|
|
27237
27271
|
}
|
|
27238
27272
|
function getAllRequestCookies(request) {
|
|
27239
27273
|
const requestCookieHeader = request.headers.get("cookie");
|
|
27240
|
-
const cookiesFromHeaders = requestCookieHeader ?
|
|
27274
|
+
const cookiesFromHeaders = requestCookieHeader ? parseCookies(requestCookieHeader) : {};
|
|
27241
27275
|
const cookiesFromDocument = getDocumentCookies(request);
|
|
27242
27276
|
for (const name in cookiesFromDocument) {
|
|
27243
27277
|
request.headers.append(
|
|
@@ -28807,13 +28841,9 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
|
|
|
28807
28841
|
storeResponseCookies(request, response);
|
|
28808
28842
|
emitter.emit("request:match", { request, requestId });
|
|
28809
28843
|
const requiredLookupResult = lookupResult.data;
|
|
28810
|
-
|
|
28811
|
-
handleRequestOptions?.onMockedResponse?.(
|
|
28812
|
-
transformedResponse,
|
|
28813
|
-
requiredLookupResult
|
|
28814
|
-
);
|
|
28844
|
+
handleRequestOptions?.onMockedResponse?.(response, requiredLookupResult);
|
|
28815
28845
|
emitter.emit("request:end", { request, requestId });
|
|
28816
|
-
return
|
|
28846
|
+
return response;
|
|
28817
28847
|
}
|
|
28818
28848
|
|
|
28819
28849
|
// src/core/getResponse.ts
|
|
@@ -29470,7 +29500,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29470
29500
|
}
|
|
29471
29501
|
};
|
|
29472
29502
|
|
|
29473
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
29503
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-4RQHC4IY.mjs
|
|
29474
29504
|
var InterceptorError = class extends Error {
|
|
29475
29505
|
constructor(message3) {
|
|
29476
29506
|
super(message3);
|
|
@@ -29574,13 +29604,17 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29574
29604
|
});
|
|
29575
29605
|
const requestAbortPromise = new DeferredPromise();
|
|
29576
29606
|
if (options.request.signal) {
|
|
29577
|
-
options.request.signal.
|
|
29578
|
-
|
|
29579
|
-
|
|
29580
|
-
|
|
29581
|
-
|
|
29582
|
-
|
|
29583
|
-
|
|
29607
|
+
if (options.request.signal.aborted) {
|
|
29608
|
+
requestAbortPromise.reject(options.request.signal.reason);
|
|
29609
|
+
} else {
|
|
29610
|
+
options.request.signal.addEventListener(
|
|
29611
|
+
"abort",
|
|
29612
|
+
() => {
|
|
29613
|
+
requestAbortPromise.reject(options.request.signal.reason);
|
|
29614
|
+
},
|
|
29615
|
+
{ once: true }
|
|
29616
|
+
);
|
|
29617
|
+
}
|
|
29584
29618
|
}
|
|
29585
29619
|
const result = await until(async () => {
|
|
29586
29620
|
const requestListtenersPromise = emitAsync(options.emitter, "request", {
|
|
@@ -29638,7 +29672,28 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29638
29672
|
return false;
|
|
29639
29673
|
}
|
|
29640
29674
|
|
|
29641
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
29675
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-TX5GBTFY.mjs
|
|
29676
|
+
function hasConfigurableGlobal(propertyName) {
|
|
29677
|
+
const descriptor = Object.getOwnPropertyDescriptor(globalThis, propertyName);
|
|
29678
|
+
if (typeof descriptor === "undefined") {
|
|
29679
|
+
return false;
|
|
29680
|
+
}
|
|
29681
|
+
if (typeof descriptor.get === "function" && typeof descriptor.get() === "undefined") {
|
|
29682
|
+
return false;
|
|
29683
|
+
}
|
|
29684
|
+
if (typeof descriptor.get === "undefined" && descriptor.value == null) {
|
|
29685
|
+
return false;
|
|
29686
|
+
}
|
|
29687
|
+
if (typeof descriptor.set === "undefined" && !descriptor.configurable) {
|
|
29688
|
+
console.error(
|
|
29689
|
+
`[MSW] Failed to apply interceptor: the global \`${propertyName}\` property is non-configurable. This is likely an issue with your environment. If you are using a framework, please open an issue about this in their repository.`
|
|
29690
|
+
);
|
|
29691
|
+
return false;
|
|
29692
|
+
}
|
|
29693
|
+
return true;
|
|
29694
|
+
}
|
|
29695
|
+
|
|
29696
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-VXLPKFY4.mjs
|
|
29642
29697
|
function canParseUrl(url) {
|
|
29643
29698
|
try {
|
|
29644
29699
|
new URL(url);
|
|
@@ -29713,12 +29768,78 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29713
29768
|
}
|
|
29714
29769
|
return false;
|
|
29715
29770
|
}
|
|
29771
|
+
var BrotliDecompressionStream = class extends TransformStream {
|
|
29772
|
+
constructor() {
|
|
29773
|
+
console.warn(
|
|
29774
|
+
"[Interceptors]: Brotli decompression of response streams is not supported in the browser"
|
|
29775
|
+
);
|
|
29776
|
+
super({
|
|
29777
|
+
transform(chunk, controller) {
|
|
29778
|
+
controller.enqueue(chunk);
|
|
29779
|
+
}
|
|
29780
|
+
});
|
|
29781
|
+
}
|
|
29782
|
+
};
|
|
29783
|
+
var PipelineStream = class extends TransformStream {
|
|
29784
|
+
constructor(transformStreams, ...strategies) {
|
|
29785
|
+
super({}, ...strategies);
|
|
29786
|
+
const readable = [super.readable, ...transformStreams].reduce(
|
|
29787
|
+
(readable2, transform) => readable2.pipeThrough(transform)
|
|
29788
|
+
);
|
|
29789
|
+
Object.defineProperty(this, "readable", {
|
|
29790
|
+
get() {
|
|
29791
|
+
return readable;
|
|
29792
|
+
}
|
|
29793
|
+
});
|
|
29794
|
+
}
|
|
29795
|
+
};
|
|
29796
|
+
function parseContentEncoding(contentEncoding) {
|
|
29797
|
+
return contentEncoding.toLowerCase().split(",").map((coding) => coding.trim());
|
|
29798
|
+
}
|
|
29799
|
+
function createDecompressionStream(contentEncoding) {
|
|
29800
|
+
if (contentEncoding === "") {
|
|
29801
|
+
return null;
|
|
29802
|
+
}
|
|
29803
|
+
const codings = parseContentEncoding(contentEncoding);
|
|
29804
|
+
if (codings.length === 0) {
|
|
29805
|
+
return null;
|
|
29806
|
+
}
|
|
29807
|
+
const transformers = codings.reduceRight(
|
|
29808
|
+
(transformers2, coding) => {
|
|
29809
|
+
if (coding === "gzip" || coding === "x-gzip") {
|
|
29810
|
+
return transformers2.concat(new DecompressionStream("gzip"));
|
|
29811
|
+
} else if (coding === "deflate") {
|
|
29812
|
+
return transformers2.concat(new DecompressionStream("deflate"));
|
|
29813
|
+
} else if (coding === "br") {
|
|
29814
|
+
return transformers2.concat(new BrotliDecompressionStream());
|
|
29815
|
+
} else {
|
|
29816
|
+
transformers2.length = 0;
|
|
29817
|
+
}
|
|
29818
|
+
return transformers2;
|
|
29819
|
+
},
|
|
29820
|
+
[]
|
|
29821
|
+
);
|
|
29822
|
+
return new PipelineStream(transformers);
|
|
29823
|
+
}
|
|
29824
|
+
function decompressResponse(response) {
|
|
29825
|
+
if (response.body === null) {
|
|
29826
|
+
return null;
|
|
29827
|
+
}
|
|
29828
|
+
const decompressionStream = createDecompressionStream(
|
|
29829
|
+
response.headers.get("content-encoding") || ""
|
|
29830
|
+
);
|
|
29831
|
+
if (!decompressionStream) {
|
|
29832
|
+
return null;
|
|
29833
|
+
}
|
|
29834
|
+
response.body.pipeTo(decompressionStream.writable);
|
|
29835
|
+
return decompressionStream.readable;
|
|
29836
|
+
}
|
|
29716
29837
|
var _FetchInterceptor = class extends Interceptor {
|
|
29717
29838
|
constructor() {
|
|
29718
29839
|
super(_FetchInterceptor.symbol);
|
|
29719
29840
|
}
|
|
29720
29841
|
checkEnvironment() {
|
|
29721
|
-
return
|
|
29842
|
+
return hasConfigurableGlobal("fetch");
|
|
29722
29843
|
}
|
|
29723
29844
|
async setup() {
|
|
29724
29845
|
const pureFetch = globalThis.fetch;
|
|
@@ -29743,10 +29864,12 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29743
29864
|
requestId,
|
|
29744
29865
|
emitter: this.emitter,
|
|
29745
29866
|
controller,
|
|
29746
|
-
onResponse: async (
|
|
29867
|
+
onResponse: async (rawResponse) => {
|
|
29747
29868
|
this.logger.info("received mocked response!", {
|
|
29748
|
-
|
|
29869
|
+
rawResponse
|
|
29749
29870
|
});
|
|
29871
|
+
const decompressedStream = decompressResponse(rawResponse);
|
|
29872
|
+
const response = decompressedStream === null ? rawResponse : new Response(decompressedStream, rawResponse);
|
|
29750
29873
|
if (RESPONSE_STATUS_CODES_WITH_REDIRECT.has(response.status)) {
|
|
29751
29874
|
if (request.redirect === "error") {
|
|
29752
29875
|
responsePromise.reject(createNetworkError("unexpected redirect"));
|
|
@@ -29764,6 +29887,12 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29764
29887
|
return;
|
|
29765
29888
|
}
|
|
29766
29889
|
}
|
|
29890
|
+
Object.defineProperty(response, "url", {
|
|
29891
|
+
writable: false,
|
|
29892
|
+
enumerable: true,
|
|
29893
|
+
configurable: false,
|
|
29894
|
+
value: request.url
|
|
29895
|
+
});
|
|
29767
29896
|
if (this.emitter.listenerCount("response") > 0) {
|
|
29768
29897
|
this.logger.info('emitting the "response" event...');
|
|
29769
29898
|
await emitAsync(this.emitter, "response", {
|
|
@@ -29776,12 +29905,6 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29776
29905
|
requestId
|
|
29777
29906
|
});
|
|
29778
29907
|
}
|
|
29779
|
-
Object.defineProperty(response, "url", {
|
|
29780
|
-
writable: false,
|
|
29781
|
-
enumerable: true,
|
|
29782
|
-
configurable: false,
|
|
29783
|
-
value: request.url
|
|
29784
|
-
});
|
|
29785
29908
|
responsePromise.resolve(response);
|
|
29786
29909
|
},
|
|
29787
29910
|
onRequestError: (response) => {
|
|
@@ -29835,7 +29958,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
29835
29958
|
var FetchInterceptor = _FetchInterceptor;
|
|
29836
29959
|
FetchInterceptor.symbol = Symbol("fetch");
|
|
29837
29960
|
|
|
29838
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
29961
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-MMAVIMED.mjs
|
|
29839
29962
|
function concatArrayBuffer(left, right) {
|
|
29840
29963
|
const result = new Uint8Array(left.byteLength + right.byteLength);
|
|
29841
29964
|
result.set(left, 0);
|
|
@@ -30582,7 +30705,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
30582
30705
|
super(_XMLHttpRequestInterceptor.interceptorSymbol);
|
|
30583
30706
|
}
|
|
30584
30707
|
checkEnvironment() {
|
|
30585
|
-
return
|
|
30708
|
+
return hasConfigurableGlobal("XMLHttpRequest");
|
|
30586
30709
|
}
|
|
30587
30710
|
setup() {
|
|
30588
30711
|
const logger = this.logger.extend("setup");
|
|
@@ -30706,7 +30829,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
30706
30829
|
}
|
|
30707
30830
|
}
|
|
30708
30831
|
|
|
30709
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.36.
|
|
30832
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/interceptors/WebSocket/index.mjs
|
|
30710
30833
|
function bindEvent(target, event) {
|
|
30711
30834
|
Object.defineProperties(event, {
|
|
30712
30835
|
target: {
|
|
@@ -31297,11 +31420,14 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
31297
31420
|
super(_WebSocketInterceptor.symbol);
|
|
31298
31421
|
}
|
|
31299
31422
|
checkEnvironment() {
|
|
31300
|
-
return
|
|
31423
|
+
return hasConfigurableGlobal("WebSocket");
|
|
31301
31424
|
}
|
|
31302
31425
|
setup() {
|
|
31303
|
-
const
|
|
31304
|
-
|
|
31426
|
+
const originalWebSocketDescriptor = Object.getOwnPropertyDescriptor(
|
|
31427
|
+
globalThis,
|
|
31428
|
+
"WebSocket"
|
|
31429
|
+
);
|
|
31430
|
+
const WebSocketProxy = new Proxy(globalThis.WebSocket, {
|
|
31305
31431
|
construct: (target, args, newTarget) => {
|
|
31306
31432
|
const [url, protocols] = args;
|
|
31307
31433
|
const createConnection = () => {
|
|
@@ -31348,9 +31474,16 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
31348
31474
|
return socket;
|
|
31349
31475
|
}
|
|
31350
31476
|
});
|
|
31351
|
-
globalThis
|
|
31477
|
+
Object.defineProperty(globalThis, "WebSocket", {
|
|
31478
|
+
value: WebSocketProxy,
|
|
31479
|
+
configurable: true
|
|
31480
|
+
});
|
|
31352
31481
|
this.subscriptions.push(() => {
|
|
31353
|
-
|
|
31482
|
+
Object.defineProperty(
|
|
31483
|
+
globalThis,
|
|
31484
|
+
"WebSocket",
|
|
31485
|
+
originalWebSocketDescriptor
|
|
31486
|
+
);
|
|
31354
31487
|
});
|
|
31355
31488
|
}
|
|
31356
31489
|
};
|