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- }
0 commit comments