@factoringplus/pl-components-pack-v3 0.5.80-pre-01 → 0.5.81-pre-01
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 +17 -17
- package/dist/mockServiceWorker.js +309 -312
- package/dist/pl-components-pack-v3.es.js +3243 -3429
- package/dist/pl-components-pack-v3.umd.js +18 -18
- package/dist/style.css +1 -1
- package/package.json +111 -83
|
@@ -8,163 +8,162 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const INTEGRITY_CHECKSUM = 'c9450df6e4dc5e45740c3b0b640727a2'
|
|
12
|
-
const activeClientIds = new Set()
|
|
11
|
+
const INTEGRITY_CHECKSUM = 'c9450df6e4dc5e45740c3b0b640727a2';
|
|
12
|
+
const activeClientIds = new Set();
|
|
13
13
|
|
|
14
14
|
self.addEventListener('install', function () {
|
|
15
|
-
|
|
16
|
-
})
|
|
15
|
+
self.skipWaiting();
|
|
16
|
+
});
|
|
17
17
|
|
|
18
18
|
self.addEventListener('activate', function (event) {
|
|
19
|
-
|
|
20
|
-
})
|
|
19
|
+
event.waitUntil(self.clients.claim());
|
|
20
|
+
});
|
|
21
21
|
|
|
22
22
|
self.addEventListener('message', async function (event) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
23
|
+
const clientId = event.source.id;
|
|
24
|
+
|
|
25
|
+
if (!clientId || !self.clients) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const client = await self.clients.get(clientId);
|
|
30
|
+
|
|
31
|
+
if (!client) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const allClients = await self.clients.matchAll({
|
|
36
|
+
type: 'window',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
switch (event.data) {
|
|
40
|
+
case 'KEEPALIVE_REQUEST': {
|
|
41
|
+
sendToClient(client, {
|
|
42
|
+
type: 'KEEPALIVE_RESPONSE',
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
case 'INTEGRITY_CHECK_REQUEST': {
|
|
48
|
+
sendToClient(client, {
|
|
49
|
+
type: 'INTEGRITY_CHECK_RESPONSE',
|
|
50
|
+
payload: INTEGRITY_CHECKSUM,
|
|
51
|
+
});
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
case 'MOCK_ACTIVATE': {
|
|
56
|
+
activeClientIds.add(clientId);
|
|
57
|
+
|
|
58
|
+
sendToClient(client, {
|
|
59
|
+
type: 'MOCKING_ENABLED',
|
|
60
|
+
payload: true,
|
|
61
|
+
});
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
case 'MOCK_DEACTIVATE': {
|
|
66
|
+
activeClientIds.delete(clientId);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
case 'CLIENT_CLOSED': {
|
|
71
|
+
activeClientIds.delete(clientId);
|
|
72
|
+
|
|
73
|
+
const remainingClients = allClients.filter((client) => {
|
|
74
|
+
return client.id !== clientId;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Unregister itself when there are no more clients
|
|
78
|
+
if (remainingClients.length === 0) {
|
|
79
|
+
self.registration.unregister();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
86
|
|
|
87
87
|
self.addEventListener('fetch', function (event) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
88
|
+
const { request } = event;
|
|
89
|
+
const accept = request.headers.get('accept') || '';
|
|
90
|
+
|
|
91
|
+
// Bypass server-sent events.
|
|
92
|
+
if (accept.includes('text/event-stream')) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Bypass navigation requests.
|
|
97
|
+
if (request.mode === 'navigate') {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Opening the DevTools triggers the "only-if-cached" request
|
|
102
|
+
// that cannot be handled by the worker. Bypass such requests.
|
|
103
|
+
if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Bypass all requests when there are no active clients.
|
|
108
|
+
// Prevents the self-unregistered worked from handling requests
|
|
109
|
+
// after it's been deleted (still remains active until the next reload).
|
|
110
|
+
if (activeClientIds.size === 0) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Generate unique request ID.
|
|
115
|
+
const requestId = Math.random().toString(16).slice(2);
|
|
116
|
+
|
|
117
|
+
event.respondWith(
|
|
118
|
+
handleRequest(event, requestId).catch((error) => {
|
|
119
|
+
if (error.name === 'NetworkError') {
|
|
120
|
+
console.warn(
|
|
121
|
+
'[MSW] Successfully emulated a network error for the "%s %s" request.',
|
|
122
|
+
request.method,
|
|
123
|
+
request.url,
|
|
124
|
+
);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// At this point, any exception indicates an issue with the original request/response.
|
|
129
|
+
console.error(
|
|
130
|
+
`\
|
|
131
131
|
[MSW] Caught an exception from the "%s %s" request (%s). This is probably not a problem with Mock Service Worker. There is likely an additional logging output above.`,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
})
|
|
132
|
+
request.method,
|
|
133
|
+
request.url,
|
|
134
|
+
`${error.name}: ${error.message}`,
|
|
135
|
+
);
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
139
|
|
|
140
140
|
async function handleRequest(event, requestId) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return response
|
|
141
|
+
const client = await resolveMainClient(event);
|
|
142
|
+
const response = await getResponse(event, client, requestId);
|
|
143
|
+
|
|
144
|
+
// Send back the response clone for the "response:*" life-cycle events.
|
|
145
|
+
// Ensure MSW is active and ready to handle the message, otherwise
|
|
146
|
+
// this message will pend indefinitely.
|
|
147
|
+
if (client && activeClientIds.has(client.id)) {
|
|
148
|
+
(async function () {
|
|
149
|
+
const clonedResponse = response.clone();
|
|
150
|
+
sendToClient(client, {
|
|
151
|
+
type: 'RESPONSE',
|
|
152
|
+
payload: {
|
|
153
|
+
requestId,
|
|
154
|
+
type: clonedResponse.type,
|
|
155
|
+
ok: clonedResponse.ok,
|
|
156
|
+
status: clonedResponse.status,
|
|
157
|
+
statusText: clonedResponse.statusText,
|
|
158
|
+
body: clonedResponse.body === null ? null : await clonedResponse.text(),
|
|
159
|
+
headers: Object.fromEntries(clonedResponse.headers.entries()),
|
|
160
|
+
redirected: clonedResponse.redirected,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
})();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return response;
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
// Resolve the main client for the given event.
|
|
@@ -172,196 +171,194 @@ async function handleRequest(event, requestId) {
|
|
|
172
171
|
// that registered the worker. It's with the latter the worker should
|
|
173
172
|
// communicate with during the response resolving phase.
|
|
174
173
|
async function resolveMainClient(event) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
174
|
+
const client = await self.clients.get(event.clientId);
|
|
175
|
+
|
|
176
|
+
if (client.frameType === 'top-level') {
|
|
177
|
+
return client;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const allClients = await self.clients.matchAll({
|
|
181
|
+
type: 'window',
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
return allClients
|
|
185
|
+
.filter((client) => {
|
|
186
|
+
// Get only those clients that are currently visible.
|
|
187
|
+
return client.visibilityState === 'visible';
|
|
188
|
+
})
|
|
189
|
+
.find((client) => {
|
|
190
|
+
// Find the client ID that's recorded in the
|
|
191
|
+
// set of clients that have registered the worker.
|
|
192
|
+
return activeClientIds.has(client.id);
|
|
193
|
+
});
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
async function getResponse(event, client, requestId) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
console.error(
|
|
289
|
-
`\
|
|
197
|
+
const { request } = event;
|
|
198
|
+
const clonedRequest = request.clone();
|
|
199
|
+
|
|
200
|
+
function passthrough() {
|
|
201
|
+
// Clone the request because it might've been already used
|
|
202
|
+
// (i.e. its body has been read and sent to the cilent).
|
|
203
|
+
const headers = Object.fromEntries(clonedRequest.headers.entries());
|
|
204
|
+
|
|
205
|
+
// Remove MSW-specific request headers so the bypassed requests
|
|
206
|
+
// comply with the server's CORS preflight check.
|
|
207
|
+
// Operate with the headers as an object because request "Headers"
|
|
208
|
+
// are immutable.
|
|
209
|
+
delete headers['x-msw-bypass'];
|
|
210
|
+
|
|
211
|
+
return fetch(clonedRequest, { headers });
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Bypass mocking when the client is not active.
|
|
215
|
+
if (!client) {
|
|
216
|
+
return passthrough();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Bypass initial page load requests (i.e. static assets).
|
|
220
|
+
// The absence of the immediate/parent client in the map of the active clients
|
|
221
|
+
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
|
|
222
|
+
// and is not ready to handle requests.
|
|
223
|
+
if (!activeClientIds.has(client.id)) {
|
|
224
|
+
return passthrough();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Bypass requests with the explicit bypass header.
|
|
228
|
+
// Such requests can be issued by "ctx.fetch()".
|
|
229
|
+
if (request.headers.get('x-msw-bypass') === 'true') {
|
|
230
|
+
return passthrough();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Create a communication channel scoped to the current request.
|
|
234
|
+
// This way events can be exchanged outside of the worker's global
|
|
235
|
+
// "message" event listener (i.e. abstracted into functions).
|
|
236
|
+
const operationChannel = new BroadcastChannel(`msw-response-stream-${requestId}`);
|
|
237
|
+
|
|
238
|
+
// Notify the client that a request has been intercepted.
|
|
239
|
+
const clientMessage = await sendToClient(client, {
|
|
240
|
+
type: 'REQUEST',
|
|
241
|
+
payload: {
|
|
242
|
+
id: requestId,
|
|
243
|
+
url: request.url,
|
|
244
|
+
method: request.method,
|
|
245
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
246
|
+
cache: request.cache,
|
|
247
|
+
mode: request.mode,
|
|
248
|
+
credentials: request.credentials,
|
|
249
|
+
destination: request.destination,
|
|
250
|
+
integrity: request.integrity,
|
|
251
|
+
redirect: request.redirect,
|
|
252
|
+
referrer: request.referrer,
|
|
253
|
+
referrerPolicy: request.referrerPolicy,
|
|
254
|
+
body: await request.text(),
|
|
255
|
+
bodyUsed: request.bodyUsed,
|
|
256
|
+
keepalive: request.keepalive,
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
switch (clientMessage.type) {
|
|
261
|
+
case 'MOCK_RESPONSE': {
|
|
262
|
+
return respondWithMock(clientMessage.payload);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
case 'MOCK_RESPONSE_START': {
|
|
266
|
+
return respondWithMockStream(operationChannel, clientMessage.payload);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
case 'MOCK_NOT_FOUND': {
|
|
270
|
+
return passthrough();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
case 'NETWORK_ERROR': {
|
|
274
|
+
const { name, message } = clientMessage.payload;
|
|
275
|
+
const networkError = new Error(message);
|
|
276
|
+
networkError.name = name;
|
|
277
|
+
|
|
278
|
+
// Rejecting a "respondWith" promise emulates a network error.
|
|
279
|
+
throw networkError;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
case 'INTERNAL_ERROR': {
|
|
283
|
+
const parsedBody = JSON.parse(clientMessage.payload.body);
|
|
284
|
+
|
|
285
|
+
console.error(
|
|
286
|
+
`\
|
|
290
287
|
[MSW] Uncaught exception in the request handler for "%s %s":
|
|
291
288
|
|
|
292
289
|
${parsedBody.location}
|
|
293
290
|
|
|
294
291
|
This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/recipes/mocking-error-responses\
|
|
295
292
|
`,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
293
|
+
request.method,
|
|
294
|
+
request.url,
|
|
295
|
+
);
|
|
299
296
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
297
|
+
return respondWithMock(clientMessage.payload);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
303
300
|
|
|
304
|
-
|
|
301
|
+
return passthrough();
|
|
305
302
|
}
|
|
306
303
|
|
|
307
304
|
function sendToClient(client, message) {
|
|
308
|
-
|
|
309
|
-
|
|
305
|
+
return new Promise((resolve, reject) => {
|
|
306
|
+
const channel = new MessageChannel();
|
|
310
307
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
308
|
+
channel.port1.onmessage = (event) => {
|
|
309
|
+
if (event.data && event.data.error) {
|
|
310
|
+
return reject(event.data.error);
|
|
311
|
+
}
|
|
315
312
|
|
|
316
|
-
|
|
317
|
-
|
|
313
|
+
resolve(event.data);
|
|
314
|
+
};
|
|
318
315
|
|
|
319
|
-
|
|
320
|
-
|
|
316
|
+
client.postMessage(JSON.stringify(message), [channel.port2]);
|
|
317
|
+
});
|
|
321
318
|
}
|
|
322
319
|
|
|
323
320
|
function sleep(timeMs) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
return new Promise((resolve) => {
|
|
322
|
+
setTimeout(resolve, timeMs);
|
|
323
|
+
});
|
|
327
324
|
}
|
|
328
325
|
|
|
329
326
|
async function respondWithMock(response) {
|
|
330
|
-
|
|
331
|
-
|
|
327
|
+
await sleep(response.delay);
|
|
328
|
+
return new Response(response.body, response);
|
|
332
329
|
}
|
|
333
330
|
|
|
334
331
|
function respondWithMockStream(operationChannel, mockResponse) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
332
|
+
let streamCtrl;
|
|
333
|
+
const stream = new ReadableStream({
|
|
334
|
+
start: (controller) => (streamCtrl = controller),
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
return new Promise(async (resolve, reject) => {
|
|
338
|
+
operationChannel.onmessageerror = (event) => {
|
|
339
|
+
operationChannel.close();
|
|
340
|
+
return reject(event.data.error);
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
operationChannel.onmessage = (event) => {
|
|
344
|
+
if (!event.data) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
switch (event.data.type) {
|
|
349
|
+
case 'MOCK_RESPONSE_CHUNK': {
|
|
350
|
+
streamCtrl.enqueue(event.data.payload);
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
case 'MOCK_RESPONSE_END': {
|
|
355
|
+
streamCtrl.close();
|
|
356
|
+
operationChannel.close();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
await sleep(mockResponse.delay);
|
|
362
|
+
return resolve(new Response(stream, mockResponse));
|
|
363
|
+
});
|
|
367
364
|
}
|