msw 0.27.0 → 0.28.1

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.
@@ -7,7 +7,7 @@
7
7
  /* eslint-disable */
8
8
  /* tslint:disable */
9
9
 
10
- const INTEGRITY_CHECKSUM = 'f7d0ed371e596d181f62c6f68c4b7baf'
10
+ const INTEGRITY_CHECKSUM = '82ef9b96d8393b6da34527d1d6e19187'
11
11
  const bypassHeaderName = 'x-msw-bypass'
12
12
  const activeClientIds = new Set()
13
13
 
@@ -114,22 +114,24 @@ async function handleRequest(event, requestId) {
114
114
  // Send back the response clone for the "response:*" life-cycle events.
115
115
  // Ensure MSW is active and ready to handle the message, otherwise
116
116
  // this message will pend indefinitely.
117
- if (activeClientIds.has(client.id)) {
118
- const clonedResponse = response.clone()
119
-
120
- sendToClient(client, {
121
- type: 'RESPONSE',
122
- payload: {
123
- requestId,
124
- type: clonedResponse.type,
125
- ok: clonedResponse.ok,
126
- status: clonedResponse.status,
127
- statusText: clonedResponse.statusText,
128
- body: clonedResponse.body === null ? null : await clonedResponse.text(),
129
- headers: serializeHeaders(clonedResponse.headers),
130
- redirected: clonedResponse.redirected,
131
- },
132
- })
117
+ if (client && activeClientIds.has(client.id)) {
118
+ ;(async function () {
119
+ const clonedResponse = response.clone()
120
+ sendToClient(client, {
121
+ type: 'RESPONSE',
122
+ payload: {
123
+ requestId,
124
+ type: clonedResponse.type,
125
+ ok: clonedResponse.ok,
126
+ status: clonedResponse.status,
127
+ statusText: clonedResponse.statusText,
128
+ body:
129
+ clonedResponse.body === null ? null : await clonedResponse.text(),
130
+ headers: serializeHeaders(clonedResponse.headers),
131
+ redirected: clonedResponse.redirected,
132
+ },
133
+ })
134
+ })()
133
135
  }
134
136
 
135
137
  return response