@zimic/interceptor 1.1.2-canary.1 → 1.1.2-canary.3
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/dist/{chunk-CGILA3WO.mjs → chunk-BJTO5JO5.mjs} +3 -5
- package/dist/{chunk-CGILA3WO.mjs.map → chunk-BJTO5JO5.mjs.map} +1 -1
- package/dist/{chunk-WCQVDF3K.js → chunk-DGUM43GV.js} +2 -5
- package/dist/{chunk-WCQVDF3K.js.map → chunk-DGUM43GV.js.map} +1 -1
- package/dist/{chunk-RDMXECNU.mjs → chunk-IZWPQ4OM.mjs} +27 -161
- package/dist/chunk-IZWPQ4OM.mjs.map +1 -0
- package/dist/{chunk-QDNKVSEG.js → chunk-XX2J7SRC.js} +27 -161
- package/dist/chunk-XX2J7SRC.js.map +1 -0
- package/dist/cli.js +20 -31
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +3 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/http.js +68 -252
- package/dist/http.js.map +1 -1
- package/dist/http.mjs +69 -253
- package/dist/http.mjs.map +1 -1
- package/dist/scripts/postinstall.js +2 -5
- package/dist/scripts/postinstall.js.map +1 -1
- package/dist/scripts/postinstall.mjs +1 -4
- package/dist/scripts/postinstall.mjs.map +1 -1
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/package.json +4 -4
- package/src/http/interceptorWorker/HttpInterceptorWorker.ts +10 -2
- package/dist/chunk-QDNKVSEG.js.map +0 -1
- package/dist/chunk-RDMXECNU.mjs.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkWCQVDF3K_js = require('./chunk-WCQVDF3K.js');
|
|
4
3
|
var http = require('@zimic/http');
|
|
5
4
|
var server = require('@whatwg-node/server');
|
|
6
5
|
var http$1 = require('http');
|
|
@@ -44,9 +43,6 @@ var z__namespace = /*#__PURE__*/_interopNamespace(z);
|
|
|
44
43
|
|
|
45
44
|
// src/server/errors/RunningInterceptorServerError.ts
|
|
46
45
|
var RunningInterceptorServerError = class extends Error {
|
|
47
|
-
static {
|
|
48
|
-
chunkWCQVDF3K_js.__name(this, "RunningInterceptorServerError");
|
|
49
|
-
}
|
|
50
46
|
constructor(additionalMessage) {
|
|
51
47
|
super(`The interceptor server is running.${additionalMessage}`);
|
|
52
48
|
this.name = "RunningInterceptorServerError";
|
|
@@ -56,9 +52,6 @@ var RunningInterceptorServerError_default = RunningInterceptorServerError;
|
|
|
56
52
|
|
|
57
53
|
// src/server/errors/NotRunningInterceptorServerError.ts
|
|
58
54
|
var NotRunningInterceptorServerError = class extends Error {
|
|
59
|
-
static {
|
|
60
|
-
chunkWCQVDF3K_js.__name(this, "NotRunningInterceptorServerError");
|
|
61
|
-
}
|
|
62
55
|
constructor() {
|
|
63
56
|
super("The interceptor server is not running. Did you forget to start it?");
|
|
64
57
|
this.name = "NotRunningInterceptorServerError";
|
|
@@ -68,23 +61,14 @@ var NotRunningInterceptorServerError_default = NotRunningInterceptorServerError;
|
|
|
68
61
|
|
|
69
62
|
// src/utils/http.ts
|
|
70
63
|
var HttpServerTimeoutError = class extends Error {
|
|
71
|
-
static {
|
|
72
|
-
chunkWCQVDF3K_js.__name(this, "HttpServerTimeoutError");
|
|
73
|
-
}
|
|
74
64
|
};
|
|
75
65
|
var HttpServerStartTimeoutError = class extends HttpServerTimeoutError {
|
|
76
|
-
static {
|
|
77
|
-
chunkWCQVDF3K_js.__name(this, "HttpServerStartTimeoutError");
|
|
78
|
-
}
|
|
79
66
|
constructor(reachedTimeout) {
|
|
80
67
|
super(`HTTP server start timed out after ${reachedTimeout}ms.`);
|
|
81
68
|
this.name = "HttpServerStartTimeout";
|
|
82
69
|
}
|
|
83
70
|
};
|
|
84
71
|
var HttpServerStopTimeoutError = class extends HttpServerTimeoutError {
|
|
85
|
-
static {
|
|
86
|
-
chunkWCQVDF3K_js.__name(this, "HttpServerStopTimeoutError");
|
|
87
|
-
}
|
|
88
72
|
constructor(reachedTimeout) {
|
|
89
73
|
super(`HTTP server stop timed out after ${reachedTimeout}ms.`);
|
|
90
74
|
this.name = "HttpServerStopTimeout";
|
|
@@ -98,7 +82,6 @@ async function startHttpServer(server, options = {}) {
|
|
|
98
82
|
server.off("listening", handleStartSuccess);
|
|
99
83
|
reject(error);
|
|
100
84
|
}
|
|
101
|
-
chunkWCQVDF3K_js.__name(handleStartError, "handleStartError");
|
|
102
85
|
const startTimeout = setTimeout(() => {
|
|
103
86
|
const timeoutError = new HttpServerStartTimeoutError(timeoutDuration);
|
|
104
87
|
handleStartError(timeoutError);
|
|
@@ -108,12 +91,10 @@ async function startHttpServer(server, options = {}) {
|
|
|
108
91
|
clearTimeout(startTimeout);
|
|
109
92
|
resolve();
|
|
110
93
|
}
|
|
111
|
-
chunkWCQVDF3K_js.__name(handleStartSuccess, "handleStartSuccess");
|
|
112
94
|
server.once("error", handleStartError);
|
|
113
95
|
server.listen(port, hostname, handleStartSuccess);
|
|
114
96
|
});
|
|
115
97
|
}
|
|
116
|
-
chunkWCQVDF3K_js.__name(startHttpServer, "startHttpServer");
|
|
117
98
|
async function stopHttpServer(server, options = {}) {
|
|
118
99
|
const { timeout: timeoutDuration = DEFAULT_HTTP_SERVER_LIFECYCLE_TIMEOUT } = options;
|
|
119
100
|
if (!server.listening) {
|
|
@@ -135,7 +116,6 @@ async function stopHttpServer(server, options = {}) {
|
|
|
135
116
|
server.closeAllConnections();
|
|
136
117
|
});
|
|
137
118
|
}
|
|
138
|
-
chunkWCQVDF3K_js.__name(stopHttpServer, "stopHttpServer");
|
|
139
119
|
function getHttpServerPort(server) {
|
|
140
120
|
const address = server.address();
|
|
141
121
|
if (typeof address === "string") {
|
|
@@ -144,7 +124,6 @@ function getHttpServerPort(server) {
|
|
|
144
124
|
return address?.port;
|
|
145
125
|
}
|
|
146
126
|
}
|
|
147
|
-
chunkWCQVDF3K_js.__name(getHttpServerPort, "getHttpServerPort");
|
|
148
127
|
var HTTP_METHODS_WITH_RESPONSE_BODY = /* @__PURE__ */ new Set([
|
|
149
128
|
"GET",
|
|
150
129
|
"POST",
|
|
@@ -156,7 +135,6 @@ var HTTP_METHODS_WITH_RESPONSE_BODY = /* @__PURE__ */ new Set([
|
|
|
156
135
|
function methodCanHaveResponseBody(method) {
|
|
157
136
|
return HTTP_METHODS_WITH_RESPONSE_BODY.has(method);
|
|
158
137
|
}
|
|
159
|
-
chunkWCQVDF3K_js.__name(methodCanHaveResponseBody, "methodCanHaveResponseBody");
|
|
160
138
|
|
|
161
139
|
// src/webSocket/errors/UnauthorizedWebSocketConnectionError.ts
|
|
162
140
|
var UnauthorizedWebSocketConnectionError = class extends Error {
|
|
@@ -165,49 +143,31 @@ var UnauthorizedWebSocketConnectionError = class extends Error {
|
|
|
165
143
|
this.event = event;
|
|
166
144
|
this.name = "UnauthorizedWebSocketConnectionError";
|
|
167
145
|
}
|
|
168
|
-
static {
|
|
169
|
-
chunkWCQVDF3K_js.__name(this, "UnauthorizedWebSocketConnectionError");
|
|
170
|
-
}
|
|
171
146
|
};
|
|
172
147
|
var UnauthorizedWebSocketConnectionError_default = UnauthorizedWebSocketConnectionError;
|
|
173
148
|
|
|
174
149
|
// src/utils/webSocket.ts
|
|
175
150
|
var WebSocketTimeoutError = class extends Error {
|
|
176
|
-
static {
|
|
177
|
-
chunkWCQVDF3K_js.__name(this, "WebSocketTimeoutError");
|
|
178
|
-
}
|
|
179
151
|
};
|
|
180
152
|
var WebSocketOpenTimeoutError = class extends WebSocketTimeoutError {
|
|
181
|
-
static {
|
|
182
|
-
chunkWCQVDF3K_js.__name(this, "WebSocketOpenTimeoutError");
|
|
183
|
-
}
|
|
184
153
|
constructor(reachedTimeout) {
|
|
185
154
|
super(`Web socket open timed out after ${reachedTimeout}ms.`);
|
|
186
155
|
this.name = "WebSocketOpenTimeout";
|
|
187
156
|
}
|
|
188
157
|
};
|
|
189
158
|
var WebSocketMessageTimeoutError = class extends WebSocketTimeoutError {
|
|
190
|
-
static {
|
|
191
|
-
chunkWCQVDF3K_js.__name(this, "WebSocketMessageTimeoutError");
|
|
192
|
-
}
|
|
193
159
|
constructor(reachedTimeout) {
|
|
194
160
|
super(`Web socket message timed out after ${reachedTimeout}ms.`);
|
|
195
161
|
this.name = "WebSocketMessageTimeout";
|
|
196
162
|
}
|
|
197
163
|
};
|
|
198
164
|
var WebSocketMessageAbortError = class extends WebSocketTimeoutError {
|
|
199
|
-
static {
|
|
200
|
-
chunkWCQVDF3K_js.__name(this, "WebSocketMessageAbortError");
|
|
201
|
-
}
|
|
202
165
|
constructor() {
|
|
203
166
|
super("Web socket message was aborted.");
|
|
204
167
|
this.name = "WebSocketMessageAbortError";
|
|
205
168
|
}
|
|
206
169
|
};
|
|
207
170
|
var WebSocketCloseTimeoutError = class extends WebSocketTimeoutError {
|
|
208
|
-
static {
|
|
209
|
-
chunkWCQVDF3K_js.__name(this, "WebSocketCloseTimeoutError");
|
|
210
|
-
}
|
|
211
171
|
constructor(reachedTimeout) {
|
|
212
172
|
super(`Web socket close timed out after ${reachedTimeout}ms.`);
|
|
213
173
|
this.name = "WebSocketCloseTimeout";
|
|
@@ -228,12 +188,10 @@ async function waitForOpenClientSocket(socket, options = {}) {
|
|
|
228
188
|
socket.removeEventListener("error", handleOpenError);
|
|
229
189
|
socket.removeEventListener("close", handleClose);
|
|
230
190
|
}
|
|
231
|
-
chunkWCQVDF3K_js.__name(removeAllSocketListeners, "removeAllSocketListeners");
|
|
232
191
|
function handleOpenError(error) {
|
|
233
192
|
removeAllSocketListeners();
|
|
234
193
|
reject(error);
|
|
235
194
|
}
|
|
236
|
-
chunkWCQVDF3K_js.__name(handleOpenError, "handleOpenError");
|
|
237
195
|
function handleClose(event) {
|
|
238
196
|
const isUnauthorized = event.code === 1008;
|
|
239
197
|
if (isUnauthorized) {
|
|
@@ -243,7 +201,6 @@ async function waitForOpenClientSocket(socket, options = {}) {
|
|
|
243
201
|
handleOpenError(event);
|
|
244
202
|
}
|
|
245
203
|
}
|
|
246
|
-
chunkWCQVDF3K_js.__name(handleClose, "handleClose");
|
|
247
204
|
const openTimeout = setTimeout(() => {
|
|
248
205
|
const timeoutError = new WebSocketOpenTimeoutError(timeoutDuration);
|
|
249
206
|
handleOpenError(timeoutError);
|
|
@@ -253,14 +210,12 @@ async function waitForOpenClientSocket(socket, options = {}) {
|
|
|
253
210
|
clearTimeout(openTimeout);
|
|
254
211
|
resolve();
|
|
255
212
|
}
|
|
256
|
-
chunkWCQVDF3K_js.__name(handleOpenSuccess, "handleOpenSuccess");
|
|
257
213
|
function handleSocketMessage(message) {
|
|
258
214
|
const hasValidAuth = message.data === "socket:auth:valid";
|
|
259
215
|
if (hasValidAuth) {
|
|
260
216
|
handleOpenSuccess();
|
|
261
217
|
}
|
|
262
218
|
}
|
|
263
|
-
chunkWCQVDF3K_js.__name(handleSocketMessage, "handleSocketMessage");
|
|
264
219
|
if (waitForAuthentication) {
|
|
265
220
|
socket.addEventListener("message", handleSocketMessage);
|
|
266
221
|
} else {
|
|
@@ -270,7 +225,6 @@ async function waitForOpenClientSocket(socket, options = {}) {
|
|
|
270
225
|
socket.addEventListener("close", handleClose);
|
|
271
226
|
});
|
|
272
227
|
}
|
|
273
|
-
chunkWCQVDF3K_js.__name(waitForOpenClientSocket, "waitForOpenClientSocket");
|
|
274
228
|
async function closeClientSocket(socket, options = {}) {
|
|
275
229
|
const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
|
|
276
230
|
const isAlreadyClosed = socket.readyState === socket.CLOSED;
|
|
@@ -282,12 +236,10 @@ async function closeClientSocket(socket, options = {}) {
|
|
|
282
236
|
socket.removeEventListener("error", handleError);
|
|
283
237
|
socket.removeEventListener("close", handleClose);
|
|
284
238
|
}
|
|
285
|
-
chunkWCQVDF3K_js.__name(removeAllSocketListeners, "removeAllSocketListeners");
|
|
286
239
|
function handleError(error) {
|
|
287
240
|
removeAllSocketListeners();
|
|
288
241
|
reject(error);
|
|
289
242
|
}
|
|
290
|
-
chunkWCQVDF3K_js.__name(handleError, "handleError");
|
|
291
243
|
const closeTimeout = setTimeout(() => {
|
|
292
244
|
const timeoutError = new WebSocketCloseTimeoutError(timeoutDuration);
|
|
293
245
|
handleError(timeoutError);
|
|
@@ -297,13 +249,11 @@ async function closeClientSocket(socket, options = {}) {
|
|
|
297
249
|
clearTimeout(closeTimeout);
|
|
298
250
|
resolve();
|
|
299
251
|
}
|
|
300
|
-
chunkWCQVDF3K_js.__name(handleClose, "handleClose");
|
|
301
252
|
socket.addEventListener("error", handleError);
|
|
302
253
|
socket.addEventListener("close", handleClose);
|
|
303
254
|
socket.close();
|
|
304
255
|
});
|
|
305
256
|
}
|
|
306
|
-
chunkWCQVDF3K_js.__name(closeClientSocket, "closeClientSocket");
|
|
307
257
|
async function closeServerSocket(socket, options = {}) {
|
|
308
258
|
const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
|
|
309
259
|
await new Promise((resolve, reject) => {
|
|
@@ -324,7 +274,6 @@ async function closeServerSocket(socket, options = {}) {
|
|
|
324
274
|
});
|
|
325
275
|
});
|
|
326
276
|
}
|
|
327
|
-
chunkWCQVDF3K_js.__name(closeServerSocket, "closeServerSocket");
|
|
328
277
|
|
|
329
278
|
// src/server/constants.ts
|
|
330
279
|
var ALLOWED_ACCESS_CONTROL_HTTP_METHODS = http.HTTP_METHODS.join(",");
|
|
@@ -339,41 +288,25 @@ var DEFAULT_PREFLIGHT_STATUS_CODE = 204;
|
|
|
339
288
|
var DEFAULT_HOSTNAME = "localhost";
|
|
340
289
|
var DEFAULT_LOG_UNHANDLED_REQUESTS = true;
|
|
341
290
|
|
|
342
|
-
// ../zimic-utils/dist/chunk-
|
|
343
|
-
var __defProp = Object.defineProperty;
|
|
344
|
-
var __name2 = /* @__PURE__ */ chunkWCQVDF3K_js.__name((target, value) => __defProp(target, "name", { value, configurable: true }), "__name");
|
|
345
|
-
|
|
346
|
-
// ../zimic-utils/dist/chunk-FPJJAH7P.mjs
|
|
291
|
+
// ../zimic-utils/dist/chunk-46M3OXFU.mjs
|
|
347
292
|
function getExtraPatternsToEscape() {
|
|
348
293
|
return /([.(){}+$])/g;
|
|
349
294
|
}
|
|
350
|
-
chunkWCQVDF3K_js.__name(getExtraPatternsToEscape, "getExtraPatternsToEscape");
|
|
351
|
-
__name2(getExtraPatternsToEscape, "getExtraPatternsToEscape");
|
|
352
295
|
function getURIEncodedBackSlashPattern() {
|
|
353
296
|
return /%5C/g;
|
|
354
297
|
}
|
|
355
|
-
chunkWCQVDF3K_js.__name(getURIEncodedBackSlashPattern, "getURIEncodedBackSlashPattern");
|
|
356
|
-
__name2(getURIEncodedBackSlashPattern, "getURIEncodedBackSlashPattern");
|
|
357
298
|
function getPathParamPattern() {
|
|
358
299
|
return /(?<escape>\\)?:(?<identifier>[$_\p{ID_Start}][$\p{ID_Continue}]+)/gu;
|
|
359
300
|
}
|
|
360
|
-
chunkWCQVDF3K_js.__name(getPathParamPattern, "getPathParamPattern");
|
|
361
|
-
__name2(getPathParamPattern, "getPathParamPattern");
|
|
362
301
|
function getRepeatingPathParamPattern() {
|
|
363
302
|
return /(?<escape>\\)?:(?<identifier>[$_\p{ID_Start}][$\p{ID_Continue}]+)\\+/gu;
|
|
364
303
|
}
|
|
365
|
-
chunkWCQVDF3K_js.__name(getRepeatingPathParamPattern, "getRepeatingPathParamPattern");
|
|
366
|
-
__name2(getRepeatingPathParamPattern, "getRepeatingPathParamPattern");
|
|
367
304
|
function getOptionalPathParamPattern() {
|
|
368
305
|
return /(?<leadingSlash>\/)?(?<escape>\\)?:(?<identifier>[$_\p{ID_Start}][$\p{ID_Continue}]+)\?(?<trailingSlash>\/)?/gu;
|
|
369
306
|
}
|
|
370
|
-
chunkWCQVDF3K_js.__name(getOptionalPathParamPattern, "getOptionalPathParamPattern");
|
|
371
|
-
__name2(getOptionalPathParamPattern, "getOptionalPathParamPattern");
|
|
372
307
|
function getOptionalRepeatingPathParamPattern() {
|
|
373
308
|
return /(?<leadingSlash>\/)?(?<escape>\\)?:(?<identifier>[$_\p{ID_Start}][$\p{ID_Continue}]+)\*(?<trailingSlash>\/)?/gu;
|
|
374
309
|
}
|
|
375
|
-
chunkWCQVDF3K_js.__name(getOptionalRepeatingPathParamPattern, "getOptionalRepeatingPathParamPattern");
|
|
376
|
-
__name2(getOptionalRepeatingPathParamPattern, "getOptionalRepeatingPathParamPattern");
|
|
377
310
|
function createParametrizedPathPattern(path2) {
|
|
378
311
|
const replacedURL = encodeURI(path2).replace(/^\/+/g, "").replace(/\/+$/g, "").replace(getExtraPatternsToEscape(), "\\$1").replace(getURIEncodedBackSlashPattern(), "\\").replace(
|
|
379
312
|
getOptionalRepeatingPathParamPattern(),
|
|
@@ -422,8 +355,6 @@ function createParametrizedPathPattern(path2) {
|
|
|
422
355
|
});
|
|
423
356
|
return new RegExp(`^/?${replacedURL}/?$`);
|
|
424
357
|
}
|
|
425
|
-
chunkWCQVDF3K_js.__name(createParametrizedPathPattern, "createParametrizedPathPattern");
|
|
426
|
-
__name2(createParametrizedPathPattern, "createParametrizedPathPattern");
|
|
427
358
|
var createParametrizedPathPattern_default = createParametrizedPathPattern;
|
|
428
359
|
|
|
429
360
|
// ../zimic-utils/dist/url/excludeURLParams.mjs
|
|
@@ -434,16 +365,12 @@ function excludeURLParams(url) {
|
|
|
434
365
|
url.password = "";
|
|
435
366
|
return url;
|
|
436
367
|
}
|
|
437
|
-
chunkWCQVDF3K_js.__name(excludeURLParams, "excludeURLParams");
|
|
438
|
-
__name2(excludeURLParams, "excludeURLParams");
|
|
439
368
|
var excludeURLParams_default = excludeURLParams;
|
|
440
369
|
|
|
441
|
-
// ../zimic-utils/dist/chunk-
|
|
370
|
+
// ../zimic-utils/dist/chunk-5UH44FTS.mjs
|
|
442
371
|
function isDefined(value) {
|
|
443
372
|
return value !== void 0 && value !== null;
|
|
444
373
|
}
|
|
445
|
-
chunkWCQVDF3K_js.__name(isDefined, "isDefined");
|
|
446
|
-
__name2(isDefined, "isDefined");
|
|
447
374
|
var isDefined_default = isDefined;
|
|
448
375
|
|
|
449
376
|
// src/utils/arrays.ts
|
|
@@ -453,39 +380,28 @@ function removeArrayIndex(array, index) {
|
|
|
453
380
|
}
|
|
454
381
|
return array;
|
|
455
382
|
}
|
|
456
|
-
chunkWCQVDF3K_js.__name(removeArrayIndex, "removeArrayIndex");
|
|
457
383
|
function removeArrayElement(array, element) {
|
|
458
384
|
const index = array.indexOf(element);
|
|
459
385
|
return removeArrayIndex(array, index);
|
|
460
386
|
}
|
|
461
|
-
chunkWCQVDF3K_js.__name(removeArrayElement, "removeArrayElement");
|
|
462
387
|
|
|
463
388
|
// src/utils/environment.ts
|
|
464
389
|
function isClientSide() {
|
|
465
390
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
466
391
|
}
|
|
467
|
-
chunkWCQVDF3K_js.__name(isClientSide, "isClientSide");
|
|
468
392
|
|
|
469
393
|
// ../zimic-utils/dist/import/createCachedDynamicImport.mjs
|
|
470
394
|
function createCachedDynamicImport(importModuleDynamically) {
|
|
471
395
|
let cachedImportResult;
|
|
472
|
-
return
|
|
396
|
+
return async function importModuleDynamicallyWithCache() {
|
|
473
397
|
cachedImportResult ??= await importModuleDynamically();
|
|
474
398
|
return cachedImportResult;
|
|
475
|
-
}
|
|
399
|
+
};
|
|
476
400
|
}
|
|
477
|
-
chunkWCQVDF3K_js.__name(createCachedDynamicImport, "createCachedDynamicImport");
|
|
478
|
-
__name2(createCachedDynamicImport, "createCachedDynamicImport");
|
|
479
401
|
var createCachedDynamicImport_default = createCachedDynamicImport;
|
|
480
402
|
|
|
481
403
|
// ../zimic-utils/dist/logging/Logger.mjs
|
|
482
404
|
var Logger = class _Logger {
|
|
483
|
-
static {
|
|
484
|
-
chunkWCQVDF3K_js.__name(this, "_Logger");
|
|
485
|
-
}
|
|
486
|
-
static {
|
|
487
|
-
__name2(this, "Logger");
|
|
488
|
-
}
|
|
489
405
|
prefix;
|
|
490
406
|
raw;
|
|
491
407
|
constructor(options = {}) {
|
|
@@ -577,7 +493,6 @@ async function pathExists(path2) {
|
|
|
577
493
|
return false;
|
|
578
494
|
}
|
|
579
495
|
}
|
|
580
|
-
chunkWCQVDF3K_js.__name(pathExists, "pathExists");
|
|
581
496
|
|
|
582
497
|
// src/utils/logging.ts
|
|
583
498
|
var logger = new Logger_default({
|
|
@@ -600,7 +515,6 @@ async function formatValueToLog(value, options = {}) {
|
|
|
600
515
|
sorted: true
|
|
601
516
|
});
|
|
602
517
|
}
|
|
603
|
-
chunkWCQVDF3K_js.__name(formatValueToLog, "formatValueToLog");
|
|
604
518
|
|
|
605
519
|
// src/http/requestHandler/types/requests.ts
|
|
606
520
|
var HTTP_INTERCEPTOR_REQUEST_HIDDEN_PROPERTIES = Object.freeze(
|
|
@@ -634,9 +548,6 @@ var DEFAULT_UNHANDLED_REQUEST_STRATEGY = Object.freeze({
|
|
|
634
548
|
|
|
635
549
|
// src/http/interceptorWorker/errors/InvalidFormDataError.ts
|
|
636
550
|
var InvalidFormDataError = class extends SyntaxError {
|
|
637
|
-
static {
|
|
638
|
-
chunkWCQVDF3K_js.__name(this, "InvalidFormDataError");
|
|
639
|
-
}
|
|
640
551
|
constructor(value) {
|
|
641
552
|
super(`Failed to parse value as form data: ${value}`);
|
|
642
553
|
this.name = "InvalidFormDataError";
|
|
@@ -646,9 +557,6 @@ var InvalidFormDataError_default = InvalidFormDataError;
|
|
|
646
557
|
|
|
647
558
|
// src/http/interceptorWorker/errors/InvalidJSONError.ts
|
|
648
559
|
var InvalidJSONError = class extends SyntaxError {
|
|
649
|
-
static {
|
|
650
|
-
chunkWCQVDF3K_js.__name(this, "InvalidJSONError");
|
|
651
|
-
}
|
|
652
560
|
constructor(value) {
|
|
653
561
|
super(`Failed to parse value as JSON: ${value}`);
|
|
654
562
|
this.name = "InvalidJSONError";
|
|
@@ -658,9 +566,6 @@ var InvalidJSONError_default = InvalidJSONError;
|
|
|
658
566
|
|
|
659
567
|
// src/http/interceptorWorker/HttpInterceptorWorker.ts
|
|
660
568
|
var HttpInterceptorWorker = class _HttpInterceptorWorker {
|
|
661
|
-
static {
|
|
662
|
-
chunkWCQVDF3K_js.__name(this, "HttpInterceptorWorker");
|
|
663
|
-
}
|
|
664
569
|
platform = null;
|
|
665
570
|
isRunning = false;
|
|
666
571
|
startingPromise;
|
|
@@ -873,8 +778,13 @@ var HttpInterceptorWorker = class _HttpInterceptorWorker {
|
|
|
873
778
|
return HTTP_INTERCEPTOR_RESPONSE_HIDDEN_PROPERTIES.has(property);
|
|
874
779
|
}
|
|
875
780
|
static parseRawPathParams(request, options) {
|
|
876
|
-
const
|
|
877
|
-
|
|
781
|
+
const requestPath = request.url.replace(options?.baseURL ?? "", "");
|
|
782
|
+
const paramsMatch = options?.pathPattern.exec(requestPath);
|
|
783
|
+
const params = {};
|
|
784
|
+
for (const [paramName, paramValue] of Object.entries(paramsMatch?.groups ?? {})) {
|
|
785
|
+
params[paramName] = typeof paramValue === "string" ? decodeURIComponent(paramValue) : void 0;
|
|
786
|
+
}
|
|
787
|
+
return params;
|
|
878
788
|
}
|
|
879
789
|
static async parseRawBody(resource) {
|
|
880
790
|
const contentType = resource.headers.get("content-type");
|
|
@@ -991,7 +901,6 @@ function convertArrayBufferToBase64(buffer) {
|
|
|
991
901
|
return Buffer.from(buffer).toString("base64");
|
|
992
902
|
}
|
|
993
903
|
}
|
|
994
|
-
chunkWCQVDF3K_js.__name(convertArrayBufferToBase64, "convertArrayBufferToBase64");
|
|
995
904
|
function convertBase64ToArrayBuffer(base64Value) {
|
|
996
905
|
if (isClientSide()) {
|
|
997
906
|
const bufferAsString = atob(base64Value);
|
|
@@ -1001,18 +910,15 @@ function convertBase64ToArrayBuffer(base64Value) {
|
|
|
1001
910
|
return Buffer.from(base64Value, "base64");
|
|
1002
911
|
}
|
|
1003
912
|
}
|
|
1004
|
-
chunkWCQVDF3K_js.__name(convertBase64ToArrayBuffer, "convertBase64ToArrayBuffer");
|
|
1005
913
|
var HEX_REGEX = /^[a-z0-9]+$/;
|
|
1006
914
|
function convertHexLengthToByteLength(hexLength) {
|
|
1007
915
|
return Math.ceil(hexLength / 2);
|
|
1008
916
|
}
|
|
1009
|
-
chunkWCQVDF3K_js.__name(convertHexLengthToByteLength, "convertHexLengthToByteLength");
|
|
1010
917
|
var BASE64URL_REGEX = /^[a-zA-Z0-9-_]+$/;
|
|
1011
918
|
function convertHexLengthToBase64urlLength(hexLength) {
|
|
1012
919
|
const byteLength = convertHexLengthToByteLength(hexLength);
|
|
1013
920
|
return Math.ceil(byteLength * 4 / 3);
|
|
1014
921
|
}
|
|
1015
|
-
chunkWCQVDF3K_js.__name(convertHexLengthToBase64urlLength, "convertHexLengthToBase64urlLength");
|
|
1016
922
|
|
|
1017
923
|
// src/utils/fetch.ts
|
|
1018
924
|
async function serializeRequest(request) {
|
|
@@ -1033,7 +939,6 @@ async function serializeRequest(request) {
|
|
|
1033
939
|
body: serializedBody
|
|
1034
940
|
};
|
|
1035
941
|
}
|
|
1036
|
-
chunkWCQVDF3K_js.__name(serializeRequest, "serializeRequest");
|
|
1037
942
|
function deserializeResponse(serializedResponse) {
|
|
1038
943
|
const deserializedBody = serializedResponse.body ? convertBase64ToArrayBuffer(serializedResponse.body) : null;
|
|
1039
944
|
return new Response(deserializedBody, {
|
|
@@ -1042,7 +947,6 @@ function deserializeResponse(serializedResponse) {
|
|
|
1042
947
|
headers: new Headers(serializedResponse.headers)
|
|
1043
948
|
});
|
|
1044
949
|
}
|
|
1045
|
-
chunkWCQVDF3K_js.__name(deserializeResponse, "deserializeResponse");
|
|
1046
950
|
|
|
1047
951
|
// src/utils/crypto.ts
|
|
1048
952
|
var importCrypto = createCachedDynamicImport_default(async () => {
|
|
@@ -1055,9 +959,6 @@ var WEB_SOCKET_CONTROL_MESSAGES = Object.freeze(["socket:auth:valid"]);
|
|
|
1055
959
|
|
|
1056
960
|
// src/webSocket/errors/InvalidWebSocketMessage.ts
|
|
1057
961
|
var InvalidWebSocketMessage = class extends Error {
|
|
1058
|
-
static {
|
|
1059
|
-
chunkWCQVDF3K_js.__name(this, "InvalidWebSocketMessage");
|
|
1060
|
-
}
|
|
1061
962
|
constructor(message) {
|
|
1062
963
|
super(`Web socket message is invalid and could not be parsed: ${message}`);
|
|
1063
964
|
this.name = "InvalidWebSocketMessage";
|
|
@@ -1067,9 +968,6 @@ var InvalidWebSocketMessage_default = InvalidWebSocketMessage;
|
|
|
1067
968
|
|
|
1068
969
|
// src/webSocket/errors/NotRunningWebSocketHandlerError.ts
|
|
1069
970
|
var NotRunningWebSocketHandlerError = class extends Error {
|
|
1070
|
-
static {
|
|
1071
|
-
chunkWCQVDF3K_js.__name(this, "NotRunningWebSocketHandlerError");
|
|
1072
|
-
}
|
|
1073
971
|
constructor() {
|
|
1074
972
|
super("Web socket handler is not running.");
|
|
1075
973
|
this.name = "NotRunningWebSocketHandlerError";
|
|
@@ -1079,9 +977,6 @@ var NotRunningWebSocketHandlerError_default = NotRunningWebSocketHandlerError;
|
|
|
1079
977
|
|
|
1080
978
|
// src/webSocket/WebSocketHandler.ts
|
|
1081
979
|
var WebSocketHandler = class {
|
|
1082
|
-
static {
|
|
1083
|
-
chunkWCQVDF3K_js.__name(this, "WebSocketHandler");
|
|
1084
|
-
}
|
|
1085
980
|
sockets = /* @__PURE__ */ new Set();
|
|
1086
981
|
socketTimeout;
|
|
1087
982
|
messageTimeout;
|
|
@@ -1098,26 +993,25 @@ var WebSocketHandler = class {
|
|
|
1098
993
|
timeout: this.socketTimeout,
|
|
1099
994
|
waitForAuthentication: options.waitForAuthentication
|
|
1100
995
|
});
|
|
1101
|
-
const handleSocketMessage =
|
|
996
|
+
const handleSocketMessage = async (rawMessage) => {
|
|
1102
997
|
await this.handleSocketMessage(socket, rawMessage);
|
|
1103
|
-
}
|
|
998
|
+
};
|
|
1104
999
|
socket.addEventListener("message", handleSocketMessage);
|
|
1105
1000
|
await openPromise;
|
|
1106
1001
|
function handleSocketError(error) {
|
|
1107
1002
|
console.error(error);
|
|
1108
1003
|
}
|
|
1109
|
-
chunkWCQVDF3K_js.__name(handleSocketError, "handleSocketError");
|
|
1110
1004
|
socket.addEventListener("error", handleSocketError);
|
|
1111
|
-
const handleSocketClose =
|
|
1005
|
+
const handleSocketClose = () => {
|
|
1112
1006
|
socket.removeEventListener("message", handleSocketMessage);
|
|
1113
1007
|
socket.removeEventListener("close", handleSocketClose);
|
|
1114
1008
|
socket.removeEventListener("error", handleSocketError);
|
|
1115
1009
|
this.removeSocket(socket);
|
|
1116
|
-
}
|
|
1010
|
+
};
|
|
1117
1011
|
socket.addEventListener("close", handleSocketClose);
|
|
1118
1012
|
this.sockets.add(socket);
|
|
1119
1013
|
}
|
|
1120
|
-
handleSocketMessage =
|
|
1014
|
+
handleSocketMessage = async (socket, rawMessage) => {
|
|
1121
1015
|
try {
|
|
1122
1016
|
if (this.isControlMessageData(rawMessage.data)) {
|
|
1123
1017
|
return;
|
|
@@ -1128,7 +1022,7 @@ var WebSocketHandler = class {
|
|
|
1128
1022
|
} catch (error) {
|
|
1129
1023
|
console.error(error);
|
|
1130
1024
|
}
|
|
1131
|
-
}
|
|
1025
|
+
};
|
|
1132
1026
|
isControlMessageData(messageData) {
|
|
1133
1027
|
return typeof messageData === "string" && WEB_SOCKET_CONTROL_MESSAGES.includes(messageData);
|
|
1134
1028
|
}
|
|
@@ -1329,9 +1223,6 @@ var WebSocketHandler_default = WebSocketHandler;
|
|
|
1329
1223
|
// src/webSocket/WebSocketServer.ts
|
|
1330
1224
|
var { WebSocketServer: ServerSocket } = ClientSocket__default.default;
|
|
1331
1225
|
var WebSocketServer = class extends WebSocketHandler_default {
|
|
1332
|
-
static {
|
|
1333
|
-
chunkWCQVDF3K_js.__name(this, "WebSocketServer");
|
|
1334
|
-
}
|
|
1335
1226
|
webSocketServer;
|
|
1336
1227
|
httpServer;
|
|
1337
1228
|
authenticate;
|
|
@@ -1387,9 +1278,6 @@ var WebSocketServer_default = WebSocketServer;
|
|
|
1387
1278
|
|
|
1388
1279
|
// src/server/errors/InvalidInterceptorTokenError.ts
|
|
1389
1280
|
var InvalidInterceptorTokenError = class extends Error {
|
|
1390
|
-
static {
|
|
1391
|
-
chunkWCQVDF3K_js.__name(this, "InvalidInterceptorTokenError");
|
|
1392
|
-
}
|
|
1393
1281
|
constructor(tokenId) {
|
|
1394
1282
|
super(`Invalid interceptor token: ${tokenId}`);
|
|
1395
1283
|
this.name = "InvalidInterceptorTokenError";
|
|
@@ -1399,9 +1287,6 @@ var InvalidInterceptorTokenError_default = InvalidInterceptorTokenError;
|
|
|
1399
1287
|
|
|
1400
1288
|
// src/server/errors/InvalidInterceptorTokenFileError.ts
|
|
1401
1289
|
var InvalidInterceptorTokenFileError = class extends Error {
|
|
1402
|
-
static {
|
|
1403
|
-
chunkWCQVDF3K_js.__name(this, "InvalidInterceptorTokenFileError");
|
|
1404
|
-
}
|
|
1405
1290
|
constructor(tokenFilePath, validationErrorMessage) {
|
|
1406
1291
|
super(`Invalid interceptor token file ${tokenFilePath}: ${validationErrorMessage}`);
|
|
1407
1292
|
this.name = "InvalidInterceptorTokenFileError";
|
|
@@ -1411,9 +1296,6 @@ var InvalidInterceptorTokenFileError_default = InvalidInterceptorTokenFileError;
|
|
|
1411
1296
|
|
|
1412
1297
|
// src/server/errors/InvalidInterceptorTokenValueError.ts
|
|
1413
1298
|
var InvalidInterceptorTokenValueError = class extends Error {
|
|
1414
|
-
static {
|
|
1415
|
-
chunkWCQVDF3K_js.__name(this, "InvalidInterceptorTokenValueError");
|
|
1416
|
-
}
|
|
1417
1299
|
constructor(tokenValue) {
|
|
1418
1300
|
super(`Invalid interceptor token value: ${tokenValue}`);
|
|
1419
1301
|
this.name = "InvalidInterceptorTokenValueError";
|
|
@@ -1450,19 +1332,15 @@ async function hashInterceptorToken(plainToken, salt) {
|
|
|
1450
1332
|
const hash = hashBuffer.toString("hex");
|
|
1451
1333
|
return hash;
|
|
1452
1334
|
}
|
|
1453
|
-
chunkWCQVDF3K_js.__name(hashInterceptorToken, "hashInterceptorToken");
|
|
1454
1335
|
function createInterceptorTokenId() {
|
|
1455
1336
|
return crypto__default.default.randomUUID().replace(/[^a-z0-9]/g, "");
|
|
1456
1337
|
}
|
|
1457
|
-
chunkWCQVDF3K_js.__name(createInterceptorTokenId, "createInterceptorTokenId");
|
|
1458
1338
|
function isValidInterceptorTokenId(tokenId) {
|
|
1459
1339
|
return tokenId.length === INTERCEPTOR_TOKEN_ID_HEX_LENGTH && HEX_REGEX.test(tokenId);
|
|
1460
1340
|
}
|
|
1461
|
-
chunkWCQVDF3K_js.__name(isValidInterceptorTokenId, "isValidInterceptorTokenId");
|
|
1462
1341
|
function isValidInterceptorTokenValue(tokenValue) {
|
|
1463
1342
|
return tokenValue.length === INTERCEPTOR_TOKEN_VALUE_BASE64URL_LENGTH && BASE64URL_REGEX.test(tokenValue);
|
|
1464
1343
|
}
|
|
1465
|
-
chunkWCQVDF3K_js.__name(isValidInterceptorTokenValue, "isValidInterceptorTokenValue");
|
|
1466
1344
|
async function createInterceptorTokensDirectory(tokensDirectory) {
|
|
1467
1345
|
try {
|
|
1468
1346
|
const parentTokensDirectory = path__default.default.dirname(tokensDirectory);
|
|
@@ -1476,7 +1354,6 @@ async function createInterceptorTokensDirectory(tokensDirectory) {
|
|
|
1476
1354
|
throw error;
|
|
1477
1355
|
}
|
|
1478
1356
|
}
|
|
1479
|
-
chunkWCQVDF3K_js.__name(createInterceptorTokensDirectory, "createInterceptorTokensDirectory");
|
|
1480
1357
|
var interceptorTokenFileContentSchema = z__namespace.object({
|
|
1481
1358
|
version: z__namespace.literal(1),
|
|
1482
1359
|
token: z__namespace.object({
|
|
@@ -1510,7 +1387,6 @@ async function saveInterceptorTokenToFile(tokensDirectory, token) {
|
|
|
1510
1387
|
});
|
|
1511
1388
|
return tokeFilePath;
|
|
1512
1389
|
}
|
|
1513
|
-
chunkWCQVDF3K_js.__name(saveInterceptorTokenToFile, "saveInterceptorTokenToFile");
|
|
1514
1390
|
async function readInterceptorTokenFromFile(tokenId, options) {
|
|
1515
1391
|
if (!isValidInterceptorTokenId(tokenId)) {
|
|
1516
1392
|
throw new InvalidInterceptorTokenError_default(tokenId);
|
|
@@ -1527,7 +1403,6 @@ async function readInterceptorTokenFromFile(tokenId, options) {
|
|
|
1527
1403
|
}
|
|
1528
1404
|
return validation.data.token;
|
|
1529
1405
|
}
|
|
1530
|
-
chunkWCQVDF3K_js.__name(readInterceptorTokenFromFile, "readInterceptorTokenFromFile");
|
|
1531
1406
|
async function createInterceptorToken(options = {}) {
|
|
1532
1407
|
const { name, tokensDirectory = DEFAULT_INTERCEPTOR_TOKENS_DIRECTORY } = options;
|
|
1533
1408
|
const tokensDirectoryExists = await pathExists(tokensDirectory);
|
|
@@ -1561,7 +1436,6 @@ async function createInterceptorToken(options = {}) {
|
|
|
1561
1436
|
await saveInterceptorTokenToFile(tokensDirectory, token);
|
|
1562
1437
|
return token;
|
|
1563
1438
|
}
|
|
1564
|
-
chunkWCQVDF3K_js.__name(createInterceptorToken, "createInterceptorToken");
|
|
1565
1439
|
async function listInterceptorTokens(options = {}) {
|
|
1566
1440
|
const { tokensDirectory = DEFAULT_INTERCEPTOR_TOKENS_DIRECTORY } = options;
|
|
1567
1441
|
const tokensDirectoryExists = await pathExists(tokensDirectory);
|
|
@@ -1589,7 +1463,6 @@ async function listInterceptorTokens(options = {}) {
|
|
|
1589
1463
|
tokens.sort((token, otherToken) => token.createdAt.getTime() - otherToken.createdAt.getTime());
|
|
1590
1464
|
return tokens;
|
|
1591
1465
|
}
|
|
1592
|
-
chunkWCQVDF3K_js.__name(listInterceptorTokens, "listInterceptorTokens");
|
|
1593
1466
|
async function validateInterceptorToken(tokenValue, options) {
|
|
1594
1467
|
if (!isValidInterceptorTokenValue(tokenValue)) {
|
|
1595
1468
|
throw new InvalidInterceptorTokenValueError_default(tokenValue);
|
|
@@ -1609,7 +1482,6 @@ async function validateInterceptorToken(tokenValue, options) {
|
|
|
1609
1482
|
throw new InvalidInterceptorTokenValueError_default(tokenValue);
|
|
1610
1483
|
}
|
|
1611
1484
|
}
|
|
1612
|
-
chunkWCQVDF3K_js.__name(validateInterceptorToken, "validateInterceptorToken");
|
|
1613
1485
|
async function removeInterceptorToken(tokenId, options = {}) {
|
|
1614
1486
|
const { tokensDirectory = DEFAULT_INTERCEPTOR_TOKENS_DIRECTORY } = options;
|
|
1615
1487
|
if (!isValidInterceptorTokenId(tokenId)) {
|
|
@@ -1618,7 +1490,6 @@ async function removeInterceptorToken(tokenId, options = {}) {
|
|
|
1618
1490
|
const tokenFilePath = path__default.default.join(tokensDirectory, tokenId);
|
|
1619
1491
|
await fs__default.default.promises.rm(tokenFilePath, { force: true });
|
|
1620
1492
|
}
|
|
1621
|
-
chunkWCQVDF3K_js.__name(removeInterceptorToken, "removeInterceptorToken");
|
|
1622
1493
|
|
|
1623
1494
|
// src/server/utils/fetch.ts
|
|
1624
1495
|
async function getFetchAPI() {
|
|
@@ -1647,13 +1518,9 @@ async function getFetchAPI() {
|
|
|
1647
1518
|
URLSearchParams
|
|
1648
1519
|
};
|
|
1649
1520
|
}
|
|
1650
|
-
chunkWCQVDF3K_js.__name(getFetchAPI, "getFetchAPI");
|
|
1651
1521
|
|
|
1652
1522
|
// src/server/InterceptorServer.ts
|
|
1653
1523
|
var InterceptorServer = class {
|
|
1654
|
-
static {
|
|
1655
|
-
chunkWCQVDF3K_js.__name(this, "InterceptorServer");
|
|
1656
|
-
}
|
|
1657
1524
|
httpServer;
|
|
1658
1525
|
webSocketServer;
|
|
1659
1526
|
_hostname;
|
|
@@ -1724,7 +1591,7 @@ var InterceptorServer = class {
|
|
|
1724
1591
|
});
|
|
1725
1592
|
this.startWebSocketServer();
|
|
1726
1593
|
}
|
|
1727
|
-
authenticateWebSocketConnection =
|
|
1594
|
+
authenticateWebSocketConnection = async (_socket, request) => {
|
|
1728
1595
|
if (!this.tokensDirectory) {
|
|
1729
1596
|
return { isValid: true };
|
|
1730
1597
|
}
|
|
@@ -1739,7 +1606,7 @@ var InterceptorServer = class {
|
|
|
1739
1606
|
console.error(error);
|
|
1740
1607
|
return { isValid: false, message: "The interceptor token is not valid." };
|
|
1741
1608
|
}
|
|
1742
|
-
}
|
|
1609
|
+
};
|
|
1743
1610
|
getWebSocketRequestTokenValue(request) {
|
|
1744
1611
|
const protocols = request.headers["sec-websocket-protocol"] ?? "";
|
|
1745
1612
|
const parametersAsString = decodeURIComponent(protocols).split(", ");
|
|
@@ -1765,13 +1632,13 @@ var InterceptorServer = class {
|
|
|
1765
1632
|
this.webSocketServerOrThrow.onEvent("interceptors/workers/commit", this.commitWorker);
|
|
1766
1633
|
this.webSocketServerOrThrow.onEvent("interceptors/workers/reset", this.resetWorker);
|
|
1767
1634
|
}
|
|
1768
|
-
commitWorker =
|
|
1635
|
+
commitWorker = (message, socket) => {
|
|
1769
1636
|
const commit = message.data;
|
|
1770
1637
|
this.registerHttpHandler(commit, socket);
|
|
1771
1638
|
this.registerWorkerSocketIfUnknown(socket);
|
|
1772
1639
|
return {};
|
|
1773
|
-
}
|
|
1774
|
-
resetWorker =
|
|
1640
|
+
};
|
|
1641
|
+
resetWorker = (message, socket) => {
|
|
1775
1642
|
this.removeHttpHandlersBySocket(socket);
|
|
1776
1643
|
const handlersToResetTo = message.data;
|
|
1777
1644
|
const isWorkerNoLongerCommitted = handlersToResetTo === void 0;
|
|
@@ -1784,7 +1651,7 @@ var InterceptorServer = class {
|
|
|
1784
1651
|
}
|
|
1785
1652
|
this.registerWorkerSocketIfUnknown(socket);
|
|
1786
1653
|
return {};
|
|
1787
|
-
}
|
|
1654
|
+
};
|
|
1788
1655
|
registerHttpHandler({ id, baseURL, method, path: path2 }, socket) {
|
|
1789
1656
|
const handlerGroups = this.httpHandlersByMethod[method];
|
|
1790
1657
|
handlerGroups.push({
|
|
@@ -1828,7 +1695,7 @@ var InterceptorServer = class {
|
|
|
1828
1695
|
await this.webSocketServerOrThrow.stop();
|
|
1829
1696
|
this.webSocketServer = void 0;
|
|
1830
1697
|
}
|
|
1831
|
-
handleHttpRequest =
|
|
1698
|
+
handleHttpRequest = async (nodeRequest, nodeResponse) => {
|
|
1832
1699
|
const request = server.normalizeNodeRequest(nodeRequest, await getFetchAPI());
|
|
1833
1700
|
const serializedRequest = await serializeRequest(request);
|
|
1834
1701
|
try {
|
|
@@ -1857,7 +1724,7 @@ var InterceptorServer = class {
|
|
|
1857
1724
|
}
|
|
1858
1725
|
nodeResponse.destroy();
|
|
1859
1726
|
}
|
|
1860
|
-
}
|
|
1727
|
+
};
|
|
1861
1728
|
async createResponseForRequest(request) {
|
|
1862
1729
|
const methodHandlers = this.httpHandlersByMethod[request.method];
|
|
1863
1730
|
const requestURL = excludeURLParams_default(new URL(request.url));
|
|
@@ -1934,7 +1801,6 @@ var InterceptorServer_default = InterceptorServer;
|
|
|
1934
1801
|
function createInterceptorServer(options = {}) {
|
|
1935
1802
|
return new InterceptorServer_default(options);
|
|
1936
1803
|
}
|
|
1937
|
-
chunkWCQVDF3K_js.__name(createInterceptorServer, "createInterceptorServer");
|
|
1938
1804
|
/* istanbul ignore next -- @preserve */
|
|
1939
1805
|
/* istanbul ignore if -- @preserve
|
|
1940
1806
|
* This is expected not to happen since the servers are not stopped unless they are running. */
|
|
@@ -1983,5 +1849,5 @@ exports.listInterceptorTokens = listInterceptorTokens;
|
|
|
1983
1849
|
exports.logger = logger;
|
|
1984
1850
|
exports.readInterceptorTokenFromFile = readInterceptorTokenFromFile;
|
|
1985
1851
|
exports.removeInterceptorToken = removeInterceptorToken;
|
|
1986
|
-
//# sourceMappingURL=chunk-
|
|
1987
|
-
//# sourceMappingURL=chunk-
|
|
1852
|
+
//# sourceMappingURL=chunk-XX2J7SRC.js.map
|
|
1853
|
+
//# sourceMappingURL=chunk-XX2J7SRC.js.map
|