Skip to content

Commit ae8218d

Browse files
committed
bump msw to 2.0.3 for the real safari fix
1 parent 9a3f95a commit ae8218d

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

mockServiceWorker.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* tslint:disable */
33

44
/**
5-
* Mock Service Worker (2.0.2).
5+
* Mock Service Worker (2.0.3).
66
* @see https://github.com/mswjs/msw
77
* - Please do NOT modify this file.
88
* - Please do NOT serve this file on production.
@@ -125,7 +125,7 @@ async function handleRequest(event, requestId) {
125125
// always be a ReadableStream, even for 204 responses.
126126
// But when creating a new Response instance on the client,
127127
// the body for a 204 response must be null.
128-
const responseBody = getSafeBody(response.status, responseClone.body)
128+
const responseBody = response.status === 204 ? null : responseClone.body
129129

130130
sendToClient(
131131
client,
@@ -281,7 +281,7 @@ async function respondWithMock(response) {
281281
return Response.error()
282282
}
283283

284-
const mockedResponse = new Response(getSafeBody(response.status, response.body), response)
284+
const mockedResponse = new Response(response.body, response)
285285

286286
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
287287
value: true,
@@ -290,23 +290,3 @@ async function respondWithMock(response) {
290290

291291
return mockedResponse
292292
}
293-
294-
/**
295-
* Ensures that the response body is only included when the status code doesn't indicate
296-
* the body should be empty
297-
*
298-
* This is a workaround required due to a bug in MSW's implementation. Once fixed this file
299-
* should be regenerated.
300-
*
301-
* @see https://github.com/mswjs/msw/issues/1827
302-
*
303-
* @param {number} status
304-
* @param {B} body
305-
* @returns {B | null}
306-
*/
307-
function getSafeBody(status, body) {
308-
if (status === 101 || status=== 103 || status === 204 || status === 205 || status === 304) {
309-
return null
310-
}
311-
return body
312-
}

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"identity-obj-proxy": "^3.0.0",
108108
"jsdom": "^22.1.0",
109109
"lint-staged": "^14.0.1",
110-
"msw": "^2.0.2",
110+
"msw": "^2.0.3",
111111
"patch-package": "^8.0.0",
112112
"postcss": "^8.2.9",
113113
"postcss-import": "^15.1.0",

0 commit comments

Comments
 (0)