@zimic/interceptor 0.16.0-canary.2 → 0.16.0-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/README.md +3 -3
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/http.d.ts +181 -206
- package/dist/http.js +190 -213
- package/dist/http.js.map +1 -1
- package/dist/http.mjs +190 -213
- package/dist/http.mjs.map +1 -1
- package/package.json +3 -3
- package/src/http/index.ts +1 -10
- package/src/http/interceptor/factory.ts +1 -1
- package/src/http/interceptor/types/options.ts +1 -1
- package/src/http/interceptor/types/public.ts +1 -1
- package/src/http/interceptor/types/schema.ts +2 -2
- package/src/http/requestHandler/types/public.ts +2 -2
- package/src/http/namespace/HttpInterceptorNamespace.ts +0 -21
package/dist/http.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpHeaders, HttpSearchParams, HttpFormData, HTTP_METHODS, HTTP_METHODS_WITH_RESPONSE_BODY } from '@zimic/http';
|
|
2
1
|
import chalk2 from 'chalk';
|
|
2
|
+
import { HttpHeaders, HttpSearchParams, HttpFormData, HTTP_METHODS, HTTP_METHODS_WITH_RESPONSE_BODY } from '@zimic/http';
|
|
3
3
|
import { http, passthrough } from 'msw';
|
|
4
4
|
import * as mswBrowser from 'msw/browser';
|
|
5
5
|
import * as mswNode from 'msw/node';
|
|
@@ -8,6 +8,68 @@ import ClientSocket from 'isomorphic-ws';
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
10
|
|
|
11
|
+
// src/http/interceptorWorker/errors/InvalidJSONError.ts
|
|
12
|
+
var InvalidJSONError = class extends SyntaxError {
|
|
13
|
+
static {
|
|
14
|
+
__name(this, "InvalidJSONError");
|
|
15
|
+
}
|
|
16
|
+
constructor(value) {
|
|
17
|
+
super(`Failed to parse value as JSON: ${value}`);
|
|
18
|
+
this.name = "InvalidJSONError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var InvalidJSONError_default = InvalidJSONError;
|
|
22
|
+
|
|
23
|
+
// src/http/interceptorWorker/errors/InvalidFormDataError.ts
|
|
24
|
+
var InvalidFormDataError = class extends SyntaxError {
|
|
25
|
+
static {
|
|
26
|
+
__name(this, "InvalidFormDataError");
|
|
27
|
+
}
|
|
28
|
+
constructor(value) {
|
|
29
|
+
super(`Failed to parse value as form data: ${value}`);
|
|
30
|
+
this.name = "InvalidFormDataError";
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var InvalidFormDataError_default = InvalidFormDataError;
|
|
34
|
+
|
|
35
|
+
// src/http/interceptor/errors/RunningHttpInterceptorError.ts
|
|
36
|
+
var RunningHttpInterceptorError = class extends Error {
|
|
37
|
+
static {
|
|
38
|
+
__name(this, "RunningHttpInterceptorError");
|
|
39
|
+
}
|
|
40
|
+
constructor(additionalMessage) {
|
|
41
|
+
super(`The interceptor is running.${additionalMessage}`);
|
|
42
|
+
this.name = "RunningHttpInterceptorError";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var RunningHttpInterceptorError_default = RunningHttpInterceptorError;
|
|
46
|
+
|
|
47
|
+
// src/http/interceptor/errors/NotRunningHttpInterceptorError.ts
|
|
48
|
+
var NotRunningHttpInterceptorError = class extends Error {
|
|
49
|
+
static {
|
|
50
|
+
__name(this, "NotRunningHttpInterceptorError");
|
|
51
|
+
}
|
|
52
|
+
constructor() {
|
|
53
|
+
super("Interceptor is not running. Did you forget to call `await interceptor.start()`?");
|
|
54
|
+
this.name = "NotRunningHttpInterceptorError";
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var NotRunningHttpInterceptorError_default = NotRunningHttpInterceptorError;
|
|
58
|
+
|
|
59
|
+
// src/http/interceptor/errors/UnknownHttpInterceptorPlatformError.ts
|
|
60
|
+
var UnknownHttpInterceptorPlatformError = class extends Error {
|
|
61
|
+
static {
|
|
62
|
+
__name(this, "UnknownHttpInterceptorPlatformError");
|
|
63
|
+
}
|
|
64
|
+
/* istanbul ignore next -- @preserve
|
|
65
|
+
* Ignoring because checking unknown platforms is currently not possible in our Vitest setup. */
|
|
66
|
+
constructor() {
|
|
67
|
+
super("Unknown interceptor platform.");
|
|
68
|
+
this.name = "UnknownHttpInterceptorPlatform";
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var UnknownHttpInterceptorPlatformError_default = UnknownHttpInterceptorPlatformError;
|
|
72
|
+
|
|
11
73
|
// src/http/interceptor/errors/UnknownHttpInterceptorTypeError.ts
|
|
12
74
|
var UnknownHttpInterceptorTypeError = class extends TypeError {
|
|
13
75
|
static {
|
|
@@ -22,102 +84,29 @@ var UnknownHttpInterceptorTypeError = class extends TypeError {
|
|
|
22
84
|
};
|
|
23
85
|
var UnknownHttpInterceptorTypeError_default = UnknownHttpInterceptorTypeError;
|
|
24
86
|
|
|
25
|
-
//
|
|
26
|
-
var
|
|
27
|
-
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
87
|
+
// src/cli/browser/shared/constants.ts
|
|
88
|
+
var SERVICE_WORKER_FILE_NAME = "mockServiceWorker.js";
|
|
28
89
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
90
|
+
// src/http/interceptorWorker/errors/UnregisteredBrowserServiceWorkerError.ts
|
|
91
|
+
var UnregisteredBrowserServiceWorkerError = class extends Error {
|
|
92
|
+
static {
|
|
93
|
+
__name(this, "UnregisteredBrowserServiceWorkerError");
|
|
94
|
+
}
|
|
95
|
+
constructor() {
|
|
96
|
+
super(
|
|
97
|
+
`Failed to register the browser service worker: script '${window.location.origin}/${SERVICE_WORKER_FILE_NAME}' not found.
|
|
36
98
|
|
|
37
|
-
|
|
38
|
-
async function blobEquals(blob, otherBlob) {
|
|
39
|
-
return blob.type === otherBlob.type && blob.size === otherBlob.size && await blob.text() === await otherBlob.text();
|
|
40
|
-
}
|
|
41
|
-
__name(blobEquals, "blobEquals");
|
|
42
|
-
__name2(blobEquals, "blobEquals");
|
|
43
|
-
var blobEquals_default = blobEquals;
|
|
99
|
+
Did you forget to run \`zimic-interceptor browser init <publicDirectory>\`?
|
|
44
100
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
__name(isPrimitiveJSONValue, "isPrimitiveJSONValue");
|
|
50
|
-
function jsonEquals(value, otherValue) {
|
|
51
|
-
if (isPrimitiveJSONValue(value)) {
|
|
52
|
-
return value === otherValue;
|
|
53
|
-
}
|
|
54
|
-
if (isPrimitiveJSONValue(otherValue)) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
if (Array.isArray(value)) {
|
|
58
|
-
if (!Array.isArray(otherValue)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (value.length !== otherValue.length) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return value.every((item, index) => jsonEquals(item, otherValue[index]));
|
|
65
|
-
}
|
|
66
|
-
if (Array.isArray(otherValue)) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
const valueKeys = Object.keys(value);
|
|
70
|
-
const otherValueKeys = Object.keys(otherValue);
|
|
71
|
-
if (valueKeys.length !== otherValueKeys.length) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
return valueKeys.every((key) => {
|
|
75
|
-
const subValue = value[key];
|
|
76
|
-
const subOtherValue = otherValue[key];
|
|
77
|
-
return jsonEquals(subValue, subOtherValue);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
__name(jsonEquals, "jsonEquals");
|
|
81
|
-
function jsonContains(value, otherValue) {
|
|
82
|
-
if (isPrimitiveJSONValue(value)) {
|
|
83
|
-
return value === otherValue;
|
|
84
|
-
}
|
|
85
|
-
if (isPrimitiveJSONValue(otherValue)) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (Array.isArray(value)) {
|
|
89
|
-
if (!Array.isArray(otherValue)) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
if (value.length < otherValue.length) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
let lastMatchedIndex = -1;
|
|
96
|
-
return otherValue.every((otherItem) => {
|
|
97
|
-
for (let index = lastMatchedIndex + 1; index < value.length; index++) {
|
|
98
|
-
if (jsonContains(value[index], otherItem)) {
|
|
99
|
-
lastMatchedIndex = index;
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
if (Array.isArray(otherValue)) {
|
|
107
|
-
return false;
|
|
101
|
+
Learn more: https://github.com/zimicjs/zimic/wiki/getting\u2010started#client-side-post-install`
|
|
102
|
+
);
|
|
103
|
+
this.name = "UnregisteredBrowserServiceWorkerError";
|
|
108
104
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (valueKeys.length < otherValueKeys.length) {
|
|
112
|
-
return false;
|
|
105
|
+
static matchesRawError(error) {
|
|
106
|
+
return error instanceof Error && error.message.toLowerCase().includes("service worker script does not exist at the given path");
|
|
113
107
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const subOtherValue = otherValue[key];
|
|
117
|
-
return jsonContains(subValue, subOtherValue);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
__name(jsonContains, "jsonContains");
|
|
108
|
+
};
|
|
109
|
+
var UnregisteredBrowserServiceWorkerError_default = UnregisteredBrowserServiceWorkerError;
|
|
121
110
|
|
|
122
111
|
// src/http/requestHandler/errors/DisabledRequestSavingError.ts
|
|
123
112
|
var DisabledRequestSavingError = class extends TypeError {
|
|
@@ -133,17 +122,9 @@ var DisabledRequestSavingError = class extends TypeError {
|
|
|
133
122
|
};
|
|
134
123
|
var DisabledRequestSavingError_default = DisabledRequestSavingError;
|
|
135
124
|
|
|
136
|
-
//
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
__name(this, "NoResponseDefinitionError");
|
|
140
|
-
}
|
|
141
|
-
constructor() {
|
|
142
|
-
super("Cannot generate a response without a definition. Use .respond() to set a response.");
|
|
143
|
-
this.name = "NoResponseDefinitionError";
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
var NoResponseDefinitionError_default = NoResponseDefinitionError;
|
|
125
|
+
// ../zimic-utils/dist/chunk-PAWJFY3S.mjs
|
|
126
|
+
var __defProp2 = Object.defineProperty;
|
|
127
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
147
128
|
|
|
148
129
|
// ../zimic-utils/dist/chunk-3O5CS47X.mjs
|
|
149
130
|
function isDefined(value) {
|
|
@@ -345,6 +326,111 @@ var TimesCheckError = class extends TypeError {
|
|
|
345
326
|
};
|
|
346
327
|
var TimesCheckError_default = TimesCheckError;
|
|
347
328
|
|
|
329
|
+
// ../zimic-utils/dist/data/blobContains.mjs
|
|
330
|
+
async function blobContains(blob, otherBlob) {
|
|
331
|
+
return blob.type === otherBlob.type && blob.size >= otherBlob.size && (await blob.text()).includes(await otherBlob.text());
|
|
332
|
+
}
|
|
333
|
+
__name(blobContains, "blobContains");
|
|
334
|
+
__name2(blobContains, "blobContains");
|
|
335
|
+
var blobContains_default = blobContains;
|
|
336
|
+
|
|
337
|
+
// ../zimic-utils/dist/chunk-HVLEF6VF.mjs
|
|
338
|
+
async function blobEquals(blob, otherBlob) {
|
|
339
|
+
return blob.type === otherBlob.type && blob.size === otherBlob.size && await blob.text() === await otherBlob.text();
|
|
340
|
+
}
|
|
341
|
+
__name(blobEquals, "blobEquals");
|
|
342
|
+
__name2(blobEquals, "blobEquals");
|
|
343
|
+
var blobEquals_default = blobEquals;
|
|
344
|
+
|
|
345
|
+
// src/utils/json.ts
|
|
346
|
+
function isPrimitiveJSONValue(value) {
|
|
347
|
+
return typeof value !== "object" || value === null;
|
|
348
|
+
}
|
|
349
|
+
__name(isPrimitiveJSONValue, "isPrimitiveJSONValue");
|
|
350
|
+
function jsonEquals(value, otherValue) {
|
|
351
|
+
if (isPrimitiveJSONValue(value)) {
|
|
352
|
+
return value === otherValue;
|
|
353
|
+
}
|
|
354
|
+
if (isPrimitiveJSONValue(otherValue)) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
if (Array.isArray(value)) {
|
|
358
|
+
if (!Array.isArray(otherValue)) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
if (value.length !== otherValue.length) {
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
return value.every((item, index) => jsonEquals(item, otherValue[index]));
|
|
365
|
+
}
|
|
366
|
+
if (Array.isArray(otherValue)) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
const valueKeys = Object.keys(value);
|
|
370
|
+
const otherValueKeys = Object.keys(otherValue);
|
|
371
|
+
if (valueKeys.length !== otherValueKeys.length) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
return valueKeys.every((key) => {
|
|
375
|
+
const subValue = value[key];
|
|
376
|
+
const subOtherValue = otherValue[key];
|
|
377
|
+
return jsonEquals(subValue, subOtherValue);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
__name(jsonEquals, "jsonEquals");
|
|
381
|
+
function jsonContains(value, otherValue) {
|
|
382
|
+
if (isPrimitiveJSONValue(value)) {
|
|
383
|
+
return value === otherValue;
|
|
384
|
+
}
|
|
385
|
+
if (isPrimitiveJSONValue(otherValue)) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
if (Array.isArray(value)) {
|
|
389
|
+
if (!Array.isArray(otherValue)) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
if (value.length < otherValue.length) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
let lastMatchedIndex = -1;
|
|
396
|
+
return otherValue.every((otherItem) => {
|
|
397
|
+
for (let index = lastMatchedIndex + 1; index < value.length; index++) {
|
|
398
|
+
if (jsonContains(value[index], otherItem)) {
|
|
399
|
+
lastMatchedIndex = index;
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return false;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
if (Array.isArray(otherValue)) {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
const valueKeys = Object.keys(value);
|
|
410
|
+
const otherValueKeys = Object.keys(otherValue);
|
|
411
|
+
if (valueKeys.length < otherValueKeys.length) {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
return otherValueKeys.every((key) => {
|
|
415
|
+
const subValue = value[key];
|
|
416
|
+
const subOtherValue = otherValue[key];
|
|
417
|
+
return jsonContains(subValue, subOtherValue);
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
__name(jsonContains, "jsonContains");
|
|
421
|
+
|
|
422
|
+
// src/http/requestHandler/errors/NoResponseDefinitionError.ts
|
|
423
|
+
var NoResponseDefinitionError = class extends TypeError {
|
|
424
|
+
static {
|
|
425
|
+
__name(this, "NoResponseDefinitionError");
|
|
426
|
+
}
|
|
427
|
+
constructor() {
|
|
428
|
+
super("Cannot generate a response without a definition. Use .respond() to set a response.");
|
|
429
|
+
this.name = "NoResponseDefinitionError";
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
var NoResponseDefinitionError_default = NoResponseDefinitionError;
|
|
433
|
+
|
|
348
434
|
// src/http/requestHandler/errors/TimesDeclarationPointer.ts
|
|
349
435
|
var TimesDeclarationPointer = class extends Error {
|
|
350
436
|
static {
|
|
@@ -760,30 +846,6 @@ var DEFAULT_UNHANDLED_REQUEST_STRATEGY = Object.freeze({
|
|
|
760
846
|
})
|
|
761
847
|
});
|
|
762
848
|
|
|
763
|
-
// src/http/interceptorWorker/errors/InvalidFormDataError.ts
|
|
764
|
-
var InvalidFormDataError = class extends SyntaxError {
|
|
765
|
-
static {
|
|
766
|
-
__name(this, "InvalidFormDataError");
|
|
767
|
-
}
|
|
768
|
-
constructor(value) {
|
|
769
|
-
super(`Failed to parse value as form data: ${value}`);
|
|
770
|
-
this.name = "InvalidFormDataError";
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
var InvalidFormDataError_default = InvalidFormDataError;
|
|
774
|
-
|
|
775
|
-
// src/http/interceptorWorker/errors/InvalidJSONError.ts
|
|
776
|
-
var InvalidJSONError = class extends SyntaxError {
|
|
777
|
-
static {
|
|
778
|
-
__name(this, "InvalidJSONError");
|
|
779
|
-
}
|
|
780
|
-
constructor(value) {
|
|
781
|
-
super(`Failed to parse value as JSON: ${value}`);
|
|
782
|
-
this.name = "InvalidJSONError";
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
var InvalidJSONError_default = InvalidJSONError;
|
|
786
|
-
|
|
787
849
|
// src/http/interceptorWorker/HttpInterceptorWorker.ts
|
|
788
850
|
var HttpInterceptorWorker = class _HttpInterceptorWorker {
|
|
789
851
|
static {
|
|
@@ -1138,58 +1200,6 @@ function validateURLPathParams(url) {
|
|
|
1138
1200
|
__name(validateURLPathParams, "validateURLPathParams");
|
|
1139
1201
|
__name2(validateURLPathParams, "validateURLPathParams");
|
|
1140
1202
|
var validateURLPathParams_default = validateURLPathParams;
|
|
1141
|
-
|
|
1142
|
-
// src/http/interceptor/errors/NotRunningHttpInterceptorError.ts
|
|
1143
|
-
var NotRunningHttpInterceptorError = class extends Error {
|
|
1144
|
-
static {
|
|
1145
|
-
__name(this, "NotRunningHttpInterceptorError");
|
|
1146
|
-
}
|
|
1147
|
-
constructor() {
|
|
1148
|
-
super("Interceptor is not running. Did you forget to call `await interceptor.start()`?");
|
|
1149
|
-
this.name = "NotRunningHttpInterceptorError";
|
|
1150
|
-
}
|
|
1151
|
-
};
|
|
1152
|
-
var NotRunningHttpInterceptorError_default = NotRunningHttpInterceptorError;
|
|
1153
|
-
|
|
1154
|
-
// src/http/interceptor/errors/UnknownHttpInterceptorPlatformError.ts
|
|
1155
|
-
var UnknownHttpInterceptorPlatformError = class extends Error {
|
|
1156
|
-
static {
|
|
1157
|
-
__name(this, "UnknownHttpInterceptorPlatformError");
|
|
1158
|
-
}
|
|
1159
|
-
/* istanbul ignore next -- @preserve
|
|
1160
|
-
* Ignoring because checking unknown platforms is currently not possible in our Vitest setup. */
|
|
1161
|
-
constructor() {
|
|
1162
|
-
super("Unknown interceptor platform.");
|
|
1163
|
-
this.name = "UnknownHttpInterceptorPlatform";
|
|
1164
|
-
}
|
|
1165
|
-
};
|
|
1166
|
-
var UnknownHttpInterceptorPlatformError_default = UnknownHttpInterceptorPlatformError;
|
|
1167
|
-
|
|
1168
|
-
// src/cli/browser/shared/constants.ts
|
|
1169
|
-
var SERVICE_WORKER_FILE_NAME = "mockServiceWorker.js";
|
|
1170
|
-
|
|
1171
|
-
// src/http/interceptorWorker/errors/UnregisteredBrowserServiceWorkerError.ts
|
|
1172
|
-
var UnregisteredBrowserServiceWorkerError = class extends Error {
|
|
1173
|
-
static {
|
|
1174
|
-
__name(this, "UnregisteredBrowserServiceWorkerError");
|
|
1175
|
-
}
|
|
1176
|
-
constructor() {
|
|
1177
|
-
super(
|
|
1178
|
-
`Failed to register the browser service worker: script '${window.location.origin}/${SERVICE_WORKER_FILE_NAME}' not found.
|
|
1179
|
-
|
|
1180
|
-
Did you forget to run \`zimic-interceptor browser init <publicDirectory>\`?
|
|
1181
|
-
|
|
1182
|
-
Learn more: https://github.com/zimicjs/zimic/wiki/getting\u2010started#client-side-post-install`
|
|
1183
|
-
);
|
|
1184
|
-
this.name = "UnregisteredBrowserServiceWorkerError";
|
|
1185
|
-
}
|
|
1186
|
-
static matchesRawError(error) {
|
|
1187
|
-
return error instanceof Error && error.message.toLowerCase().includes("service worker script does not exist at the given path");
|
|
1188
|
-
}
|
|
1189
|
-
};
|
|
1190
|
-
var UnregisteredBrowserServiceWorkerError_default = UnregisteredBrowserServiceWorkerError;
|
|
1191
|
-
|
|
1192
|
-
// src/http/interceptorWorker/LocalHttpInterceptorWorker.ts
|
|
1193
1203
|
var LocalHttpInterceptorWorker = class extends HttpInterceptorWorker_default {
|
|
1194
1204
|
static {
|
|
1195
1205
|
__name(this, "LocalHttpInterceptorWorker");
|
|
@@ -1447,18 +1457,6 @@ var RemoteHttpRequestHandler = class {
|
|
|
1447
1457
|
};
|
|
1448
1458
|
var RemoteHttpRequestHandler_default = RemoteHttpRequestHandler;
|
|
1449
1459
|
|
|
1450
|
-
// src/http/interceptor/errors/RunningHttpInterceptorError.ts
|
|
1451
|
-
var RunningHttpInterceptorError = class extends Error {
|
|
1452
|
-
static {
|
|
1453
|
-
__name(this, "RunningHttpInterceptorError");
|
|
1454
|
-
}
|
|
1455
|
-
constructor(additionalMessage) {
|
|
1456
|
-
super(`The interceptor is running.${additionalMessage}`);
|
|
1457
|
-
this.name = "RunningHttpInterceptorError";
|
|
1458
|
-
}
|
|
1459
|
-
};
|
|
1460
|
-
var RunningHttpInterceptorError_default = RunningHttpInterceptorError;
|
|
1461
|
-
|
|
1462
1460
|
// src/http/interceptor/HttpInterceptorClient.ts
|
|
1463
1461
|
var SUPPORTED_BASE_URL_PROTOCOLS = Object.freeze(["http", "https"]);
|
|
1464
1462
|
var HttpInterceptorClient = class {
|
|
@@ -2563,27 +2561,6 @@ function createHttpInterceptor(options) {
|
|
|
2563
2561
|
throw new UnknownHttpInterceptorTypeError_default(type);
|
|
2564
2562
|
}
|
|
2565
2563
|
__name(createHttpInterceptor, "createHttpInterceptor");
|
|
2566
|
-
|
|
2567
|
-
// src/http/namespace/HttpInterceptorNamespace.ts
|
|
2568
|
-
var HttpInterceptorNamespace = class {
|
|
2569
|
-
static {
|
|
2570
|
-
__name(this, "HttpInterceptorNamespace");
|
|
2571
|
-
}
|
|
2572
|
-
/**
|
|
2573
|
-
* Creates an HTTP interceptor.
|
|
2574
|
-
*
|
|
2575
|
-
* @param options The options for the interceptor.
|
|
2576
|
-
* @returns The created HTTP interceptor.
|
|
2577
|
-
* @throws {InvalidURLError} If the base URL is invalid.
|
|
2578
|
-
* @throws {UnsupportedURLProtocolError} If the base URL protocol is not either `http` or `https`.
|
|
2579
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `httpInterceptor.create(options)` API reference}
|
|
2580
|
-
*/
|
|
2581
|
-
create = createHttpInterceptor;
|
|
2582
|
-
};
|
|
2583
|
-
var HttpInterceptorNamespace_default = HttpInterceptorNamespace;
|
|
2584
|
-
|
|
2585
|
-
// src/http/index.ts
|
|
2586
|
-
var httpInterceptor = Object.freeze(new HttpInterceptorNamespace_default());
|
|
2587
2564
|
/* istanbul ignore else -- @preserve */
|
|
2588
2565
|
/* istanbul ignore next -- @preserve
|
|
2589
2566
|
* Ignoring because checking unknown platforms is not configured in our test setup. */
|
|
@@ -2599,6 +2576,6 @@ var httpInterceptor = Object.freeze(new HttpInterceptorNamespace_default());
|
|
|
2599
2576
|
* Reply listeners are always present when notified in normal conditions. If they were not present, the request
|
|
2600
2577
|
* would reach a timeout and not be responded. The empty set serves as a fallback. */
|
|
2601
2578
|
|
|
2602
|
-
export { DisabledRequestSavingError_default as DisabledRequestSavingError, InvalidFormDataError_default as InvalidFormDataError, InvalidJSONError_default as InvalidJSONError, NotRunningHttpInterceptorError_default as NotRunningHttpInterceptorError, RunningHttpInterceptorError_default as RunningHttpInterceptorError, TimesCheckError_default as TimesCheckError, UnknownHttpInterceptorPlatformError_default as UnknownHttpInterceptorPlatformError, UnknownHttpInterceptorTypeError_default as UnknownHttpInterceptorTypeError, UnregisteredBrowserServiceWorkerError_default as UnregisteredBrowserServiceWorkerError,
|
|
2579
|
+
export { DisabledRequestSavingError_default as DisabledRequestSavingError, InvalidFormDataError_default as InvalidFormDataError, InvalidJSONError_default as InvalidJSONError, NotRunningHttpInterceptorError_default as NotRunningHttpInterceptorError, RunningHttpInterceptorError_default as RunningHttpInterceptorError, TimesCheckError_default as TimesCheckError, UnknownHttpInterceptorPlatformError_default as UnknownHttpInterceptorPlatformError, UnknownHttpInterceptorTypeError_default as UnknownHttpInterceptorTypeError, UnregisteredBrowserServiceWorkerError_default as UnregisteredBrowserServiceWorkerError, createHttpInterceptor };
|
|
2603
2580
|
//# sourceMappingURL=http.mjs.map
|
|
2604
2581
|
//# sourceMappingURL=http.mjs.map
|