msw 1.2.1 → 1.2.2
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/README.md +38 -9
- package/lib/iife/index.js +11 -10
- package/lib/iife/index.js.map +1 -1
- package/lib/index.js +11 -10
- package/lib/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/lib/native/index.js +2 -1
- package/lib/native/index.mjs +2 -1
- package/lib/node/index.js +2 -1
- package/lib/node/index.js.map +1 -1
- package/lib/node/index.mjs +2 -1
- package/lib/node/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -192,12 +192,18 @@ Mock Service Worker is trusted by hundreds of thousands of engineers around the
|
|
|
192
192
|
|
|
193
193
|
<br />
|
|
194
194
|
|
|
195
|
-
<
|
|
196
|
-
<
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
<table>
|
|
196
|
+
<tr>
|
|
197
|
+
<td>
|
|
198
|
+
<a href="https://www.github.com/" target="_blank">
|
|
199
|
+
<picture>
|
|
200
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/sponsors/github-light.svg" />
|
|
201
|
+
<img src="media/sponsors/github.svg" alt="GitHub" width="75" />
|
|
202
|
+
</picture>
|
|
203
|
+
</a>
|
|
204
|
+
</td>
|
|
205
|
+
</tr>
|
|
206
|
+
</table>
|
|
201
207
|
|
|
202
208
|
### Silver Sponsors
|
|
203
209
|
|
|
@@ -207,9 +213,20 @@ Mock Service Worker is trusted by hundreds of thousands of engineers around the
|
|
|
207
213
|
|
|
208
214
|
<br />
|
|
209
215
|
|
|
210
|
-
<
|
|
211
|
-
<
|
|
212
|
-
|
|
216
|
+
<table>
|
|
217
|
+
<tr>
|
|
218
|
+
<td>
|
|
219
|
+
<a href="https://www.replay.io/" target="_blank">
|
|
220
|
+
<img src="media/sponsors/replay.svg" alt="Replay" width="75" />
|
|
221
|
+
</a>
|
|
222
|
+
</td>
|
|
223
|
+
<td>
|
|
224
|
+
<a href="https://www.chromatic.com/" target="_blank">
|
|
225
|
+
<img src="media/sponsors/chromatic.svg" alt="Chromatic" width="75" />
|
|
226
|
+
</a>
|
|
227
|
+
</td>
|
|
228
|
+
</tr>
|
|
229
|
+
</table>
|
|
213
230
|
|
|
214
231
|
### Bronze Sponsors
|
|
215
232
|
|
|
@@ -217,6 +234,18 @@ Mock Service Worker is trusted by hundreds of thousands of engineers around the
|
|
|
217
234
|
>
|
|
218
235
|
> **Learn more on our [GitHub Sponsors profile](https://github.com/sponsors/mswjs)**.
|
|
219
236
|
|
|
237
|
+
<br />
|
|
238
|
+
|
|
239
|
+
<table>
|
|
240
|
+
<tr>
|
|
241
|
+
<td>
|
|
242
|
+
<a href="https://materialize.com/" target="_blank">
|
|
243
|
+
<img src="media/sponsors/materialize.svg" alt="Materialize" width="75" />
|
|
244
|
+
</a>
|
|
245
|
+
</td>
|
|
246
|
+
</tr>
|
|
247
|
+
</table>
|
|
248
|
+
|
|
220
249
|
## Awards & Mentions
|
|
221
250
|
|
|
222
251
|
We've been extremely humbled to receive awards and mentions from the community for all the innovation and reach Mock Service Worker brings to the JavaScript ecosystem.
|
package/lib/iife/index.js
CHANGED
|
@@ -11478,9 +11478,10 @@ spurious results.`);
|
|
|
11478
11478
|
// src/utils/logging/prepareResponse.ts
|
|
11479
11479
|
function prepareResponse(res) {
|
|
11480
11480
|
const responseHeaders = objectToHeaders(res.headers);
|
|
11481
|
+
const parsedBody = parseBody(res.body, responseHeaders);
|
|
11481
11482
|
return {
|
|
11482
11483
|
...res,
|
|
11483
|
-
body:
|
|
11484
|
+
body: parsedBody
|
|
11484
11485
|
};
|
|
11485
11486
|
}
|
|
11486
11487
|
|
|
@@ -12441,12 +12442,12 @@ Read more: https://mswjs.io/docs/getting-started/mocks`
|
|
|
12441
12442
|
}
|
|
12442
12443
|
|
|
12443
12444
|
// src/utils/logging/serializeResponse.ts
|
|
12444
|
-
function serializeResponse(
|
|
12445
|
+
async function serializeResponse(response2) {
|
|
12445
12446
|
return {
|
|
12446
|
-
status:
|
|
12447
|
-
statusText:
|
|
12448
|
-
headers: flattenHeadersObject(headersToObject(
|
|
12449
|
-
body:
|
|
12447
|
+
status: response2.status,
|
|
12448
|
+
statusText: response2.statusText,
|
|
12449
|
+
headers: flattenHeadersObject(headersToObject(response2.headers)),
|
|
12450
|
+
body: await response2.text()
|
|
12450
12451
|
};
|
|
12451
12452
|
}
|
|
12452
12453
|
|
|
@@ -12487,10 +12488,10 @@ Read more: https://mswjs.io/docs/getting-started/mocks`
|
|
|
12487
12488
|
[responseBodyBuffer]
|
|
12488
12489
|
);
|
|
12489
12490
|
if (!options.quiet) {
|
|
12490
|
-
context.emitter.once("response:mocked", (response3) => {
|
|
12491
|
+
context.emitter.once("response:mocked", async (response3) => {
|
|
12491
12492
|
handler.log(
|
|
12492
12493
|
publicRequest,
|
|
12493
|
-
serializeResponse(response3),
|
|
12494
|
+
await serializeResponse(response3),
|
|
12494
12495
|
parsedRequest
|
|
12495
12496
|
);
|
|
12496
12497
|
});
|
|
@@ -12800,10 +12801,10 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
12800
12801
|
},
|
|
12801
12802
|
onMockedResponse(_, { handler, publicRequest, parsedRequest }) {
|
|
12802
12803
|
if (!options.quiet) {
|
|
12803
|
-
context.emitter.once("response:mocked", (response3) => {
|
|
12804
|
+
context.emitter.once("response:mocked", async (response3) => {
|
|
12804
12805
|
handler.log(
|
|
12805
12806
|
publicRequest,
|
|
12806
|
-
serializeResponse(response3),
|
|
12807
|
+
await serializeResponse(response3),
|
|
12807
12808
|
parsedRequest
|
|
12808
12809
|
);
|
|
12809
12810
|
});
|