This commit is contained in:
Nathan Bierema 2024-06-06 22:11:29 -04:00
parent b7a7143c15
commit 274750e8b5

View File

@ -2,13 +2,14 @@
/* tslint:disable */ /* tslint:disable */
/** /**
* Mock Service Worker (2.2.3). * Mock Service Worker.
* @see https://github.com/mswjs/msw * @see https://github.com/mswjs/msw
* - Please do NOT modify this file. * - Please do NOT modify this file.
* - Please do NOT serve this file on production. * - Please do NOT serve this file on production.
*/ */
const INTEGRITY_CHECKSUM = '223d191a56023cd36aa88c802961b911' const PACKAGE_VERSION = '2.3.1'
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set() const activeClientIds = new Set()
@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) {
case 'INTEGRITY_CHECK_REQUEST': { case 'INTEGRITY_CHECK_REQUEST': {
sendToClient(client, { sendToClient(client, {
type: 'INTEGRITY_CHECK_RESPONSE', type: 'INTEGRITY_CHECK_RESPONSE',
payload: INTEGRITY_CHECKSUM, payload: {
packageVersion: PACKAGE_VERSION,
checksum: INTEGRITY_CHECKSUM,
},
}) })
break break
} }
@ -202,13 +206,6 @@ async function getResponse(event, client, requestId) {
return passthrough() return passthrough()
} }
// Bypass requests with the explicit bypass header.
// Such requests can be issued by "ctx.fetch()".
const mswIntention = request.headers.get('x-msw-intention')
if (['bypass', 'passthrough'].includes(mswIntention)) {
return passthrough()
}
// Notify the client that a request has been intercepted. // Notify the client that a request has been intercepted.
const requestBuffer = await request.arrayBuffer() const requestBuffer = await request.arrayBuffer()
const clientMessage = await sendToClient( const clientMessage = await sendToClient(
@ -240,7 +237,7 @@ async function getResponse(event, client, requestId) {
return respondWithMock(clientMessage.data) return respondWithMock(clientMessage.data)
} }
case 'MOCK_NOT_FOUND': { case 'PASSTHROUGH': {
return passthrough() return passthrough()
} }
} }