@zimic/interceptor 0.16.0-canary.2 → 0.16.0-canary.4
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/{chunk-D7CDDSQE.js → chunk-HYJ5EZ6I.js} +246 -264
- package/dist/chunk-HYJ5EZ6I.js.map +1 -0
- package/dist/{chunk-2RNFR6TF.mjs → chunk-NY62MKKU.mjs} +246 -264
- package/dist/chunk-NY62MKKU.mjs.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +3 -3
- 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/dist/server.d.ts +20 -46
- package/dist/server.js +7 -7
- package/dist/server.mjs +1 -1
- package/package.json +3 -3
- package/src/cli/server/start.ts +2 -2
- 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/server/index.ts +1 -11
- package/dist/chunk-2RNFR6TF.mjs.map +0 -1
- package/dist/chunk-D7CDDSQE.js.map +0 -1
- package/src/http/namespace/HttpInterceptorNamespace.ts +0 -21
- package/src/server/namespace/InterceptorServerNamespace.ts +0 -21
package/dist/http.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var http = require('@zimic/http');
|
|
4
3
|
var chalk2 = require('chalk');
|
|
4
|
+
var http = require('@zimic/http');
|
|
5
5
|
var msw = require('msw');
|
|
6
6
|
var mswBrowser = require('msw/browser');
|
|
7
7
|
var mswNode = require('msw/node');
|
|
@@ -35,6 +35,68 @@ var ClientSocket__default = /*#__PURE__*/_interopDefault(ClientSocket);
|
|
|
35
35
|
var __defProp = Object.defineProperty;
|
|
36
36
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
37
37
|
|
|
38
|
+
// src/http/interceptorWorker/errors/InvalidJSONError.ts
|
|
39
|
+
var InvalidJSONError = class extends SyntaxError {
|
|
40
|
+
static {
|
|
41
|
+
__name(this, "InvalidJSONError");
|
|
42
|
+
}
|
|
43
|
+
constructor(value) {
|
|
44
|
+
super(`Failed to parse value as JSON: ${value}`);
|
|
45
|
+
this.name = "InvalidJSONError";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var InvalidJSONError_default = InvalidJSONError;
|
|
49
|
+
|
|
50
|
+
// src/http/interceptorWorker/errors/InvalidFormDataError.ts
|
|
51
|
+
var InvalidFormDataError = class extends SyntaxError {
|
|
52
|
+
static {
|
|
53
|
+
__name(this, "InvalidFormDataError");
|
|
54
|
+
}
|
|
55
|
+
constructor(value) {
|
|
56
|
+
super(`Failed to parse value as form data: ${value}`);
|
|
57
|
+
this.name = "InvalidFormDataError";
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var InvalidFormDataError_default = InvalidFormDataError;
|
|
61
|
+
|
|
62
|
+
// src/http/interceptor/errors/RunningHttpInterceptorError.ts
|
|
63
|
+
var RunningHttpInterceptorError = class extends Error {
|
|
64
|
+
static {
|
|
65
|
+
__name(this, "RunningHttpInterceptorError");
|
|
66
|
+
}
|
|
67
|
+
constructor(additionalMessage) {
|
|
68
|
+
super(`The interceptor is running.${additionalMessage}`);
|
|
69
|
+
this.name = "RunningHttpInterceptorError";
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var RunningHttpInterceptorError_default = RunningHttpInterceptorError;
|
|
73
|
+
|
|
74
|
+
// src/http/interceptor/errors/NotRunningHttpInterceptorError.ts
|
|
75
|
+
var NotRunningHttpInterceptorError = class extends Error {
|
|
76
|
+
static {
|
|
77
|
+
__name(this, "NotRunningHttpInterceptorError");
|
|
78
|
+
}
|
|
79
|
+
constructor() {
|
|
80
|
+
super("Interceptor is not running. Did you forget to call `await interceptor.start()`?");
|
|
81
|
+
this.name = "NotRunningHttpInterceptorError";
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var NotRunningHttpInterceptorError_default = NotRunningHttpInterceptorError;
|
|
85
|
+
|
|
86
|
+
// src/http/interceptor/errors/UnknownHttpInterceptorPlatformError.ts
|
|
87
|
+
var UnknownHttpInterceptorPlatformError = class extends Error {
|
|
88
|
+
static {
|
|
89
|
+
__name(this, "UnknownHttpInterceptorPlatformError");
|
|
90
|
+
}
|
|
91
|
+
/* istanbul ignore next -- @preserve
|
|
92
|
+
* Ignoring because checking unknown platforms is currently not possible in our Vitest setup. */
|
|
93
|
+
constructor() {
|
|
94
|
+
super("Unknown interceptor platform.");
|
|
95
|
+
this.name = "UnknownHttpInterceptorPlatform";
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var UnknownHttpInterceptorPlatformError_default = UnknownHttpInterceptorPlatformError;
|
|
99
|
+
|
|
38
100
|
// src/http/interceptor/errors/UnknownHttpInterceptorTypeError.ts
|
|
39
101
|
var UnknownHttpInterceptorTypeError = class extends TypeError {
|
|
40
102
|
static {
|
|
@@ -49,102 +111,29 @@ var UnknownHttpInterceptorTypeError = class extends TypeError {
|
|
|
49
111
|
};
|
|
50
112
|
var UnknownHttpInterceptorTypeError_default = UnknownHttpInterceptorTypeError;
|
|
51
113
|
|
|
52
|
-
//
|
|
53
|
-
var
|
|
54
|
-
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
114
|
+
// src/cli/browser/shared/constants.ts
|
|
115
|
+
var SERVICE_WORKER_FILE_NAME = "mockServiceWorker.js";
|
|
55
116
|
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
117
|
+
// src/http/interceptorWorker/errors/UnregisteredBrowserServiceWorkerError.ts
|
|
118
|
+
var UnregisteredBrowserServiceWorkerError = class extends Error {
|
|
119
|
+
static {
|
|
120
|
+
__name(this, "UnregisteredBrowserServiceWorkerError");
|
|
121
|
+
}
|
|
122
|
+
constructor() {
|
|
123
|
+
super(
|
|
124
|
+
`Failed to register the browser service worker: script '${window.location.origin}/${SERVICE_WORKER_FILE_NAME}' not found.
|
|
63
125
|
|
|
64
|
-
|
|
65
|
-
async function blobEquals(blob, otherBlob) {
|
|
66
|
-
return blob.type === otherBlob.type && blob.size === otherBlob.size && await blob.text() === await otherBlob.text();
|
|
67
|
-
}
|
|
68
|
-
__name(blobEquals, "blobEquals");
|
|
69
|
-
__name2(blobEquals, "blobEquals");
|
|
70
|
-
var blobEquals_default = blobEquals;
|
|
126
|
+
Did you forget to run \`zimic-interceptor browser init <publicDirectory>\`?
|
|
71
127
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
__name(isPrimitiveJSONValue, "isPrimitiveJSONValue");
|
|
77
|
-
function jsonEquals(value, otherValue) {
|
|
78
|
-
if (isPrimitiveJSONValue(value)) {
|
|
79
|
-
return value === otherValue;
|
|
80
|
-
}
|
|
81
|
-
if (isPrimitiveJSONValue(otherValue)) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
if (Array.isArray(value)) {
|
|
85
|
-
if (!Array.isArray(otherValue)) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (value.length !== otherValue.length) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
return value.every((item, index) => jsonEquals(item, otherValue[index]));
|
|
92
|
-
}
|
|
93
|
-
if (Array.isArray(otherValue)) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
const valueKeys = Object.keys(value);
|
|
97
|
-
const otherValueKeys = Object.keys(otherValue);
|
|
98
|
-
if (valueKeys.length !== otherValueKeys.length) {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
return valueKeys.every((key) => {
|
|
102
|
-
const subValue = value[key];
|
|
103
|
-
const subOtherValue = otherValue[key];
|
|
104
|
-
return jsonEquals(subValue, subOtherValue);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
__name(jsonEquals, "jsonEquals");
|
|
108
|
-
function jsonContains(value, otherValue) {
|
|
109
|
-
if (isPrimitiveJSONValue(value)) {
|
|
110
|
-
return value === otherValue;
|
|
111
|
-
}
|
|
112
|
-
if (isPrimitiveJSONValue(otherValue)) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
if (Array.isArray(value)) {
|
|
116
|
-
if (!Array.isArray(otherValue)) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
if (value.length < otherValue.length) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
let lastMatchedIndex = -1;
|
|
123
|
-
return otherValue.every((otherItem) => {
|
|
124
|
-
for (let index = lastMatchedIndex + 1; index < value.length; index++) {
|
|
125
|
-
if (jsonContains(value[index], otherItem)) {
|
|
126
|
-
lastMatchedIndex = index;
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return false;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
if (Array.isArray(otherValue)) {
|
|
134
|
-
return false;
|
|
128
|
+
Learn more: https://github.com/zimicjs/zimic/wiki/getting\u2010started#client-side-post-install`
|
|
129
|
+
);
|
|
130
|
+
this.name = "UnregisteredBrowserServiceWorkerError";
|
|
135
131
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (valueKeys.length < otherValueKeys.length) {
|
|
139
|
-
return false;
|
|
132
|
+
static matchesRawError(error) {
|
|
133
|
+
return error instanceof Error && error.message.toLowerCase().includes("service worker script does not exist at the given path");
|
|
140
134
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const subOtherValue = otherValue[key];
|
|
144
|
-
return jsonContains(subValue, subOtherValue);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
__name(jsonContains, "jsonContains");
|
|
135
|
+
};
|
|
136
|
+
var UnregisteredBrowserServiceWorkerError_default = UnregisteredBrowserServiceWorkerError;
|
|
148
137
|
|
|
149
138
|
// src/http/requestHandler/errors/DisabledRequestSavingError.ts
|
|
150
139
|
var DisabledRequestSavingError = class extends TypeError {
|
|
@@ -160,17 +149,9 @@ var DisabledRequestSavingError = class extends TypeError {
|
|
|
160
149
|
};
|
|
161
150
|
var DisabledRequestSavingError_default = DisabledRequestSavingError;
|
|
162
151
|
|
|
163
|
-
//
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
__name(this, "NoResponseDefinitionError");
|
|
167
|
-
}
|
|
168
|
-
constructor() {
|
|
169
|
-
super("Cannot generate a response without a definition. Use .respond() to set a response.");
|
|
170
|
-
this.name = "NoResponseDefinitionError";
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
var NoResponseDefinitionError_default = NoResponseDefinitionError;
|
|
152
|
+
// ../zimic-utils/dist/chunk-PAWJFY3S.mjs
|
|
153
|
+
var __defProp2 = Object.defineProperty;
|
|
154
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
174
155
|
|
|
175
156
|
// ../zimic-utils/dist/chunk-3O5CS47X.mjs
|
|
176
157
|
function isDefined(value) {
|
|
@@ -372,6 +353,111 @@ var TimesCheckError = class extends TypeError {
|
|
|
372
353
|
};
|
|
373
354
|
var TimesCheckError_default = TimesCheckError;
|
|
374
355
|
|
|
356
|
+
// ../zimic-utils/dist/data/blobContains.mjs
|
|
357
|
+
async function blobContains(blob, otherBlob) {
|
|
358
|
+
return blob.type === otherBlob.type && blob.size >= otherBlob.size && (await blob.text()).includes(await otherBlob.text());
|
|
359
|
+
}
|
|
360
|
+
__name(blobContains, "blobContains");
|
|
361
|
+
__name2(blobContains, "blobContains");
|
|
362
|
+
var blobContains_default = blobContains;
|
|
363
|
+
|
|
364
|
+
// ../zimic-utils/dist/chunk-HVLEF6VF.mjs
|
|
365
|
+
async function blobEquals(blob, otherBlob) {
|
|
366
|
+
return blob.type === otherBlob.type && blob.size === otherBlob.size && await blob.text() === await otherBlob.text();
|
|
367
|
+
}
|
|
368
|
+
__name(blobEquals, "blobEquals");
|
|
369
|
+
__name2(blobEquals, "blobEquals");
|
|
370
|
+
var blobEquals_default = blobEquals;
|
|
371
|
+
|
|
372
|
+
// src/utils/json.ts
|
|
373
|
+
function isPrimitiveJSONValue(value) {
|
|
374
|
+
return typeof value !== "object" || value === null;
|
|
375
|
+
}
|
|
376
|
+
__name(isPrimitiveJSONValue, "isPrimitiveJSONValue");
|
|
377
|
+
function jsonEquals(value, otherValue) {
|
|
378
|
+
if (isPrimitiveJSONValue(value)) {
|
|
379
|
+
return value === otherValue;
|
|
380
|
+
}
|
|
381
|
+
if (isPrimitiveJSONValue(otherValue)) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
if (Array.isArray(value)) {
|
|
385
|
+
if (!Array.isArray(otherValue)) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
if (value.length !== otherValue.length) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
return value.every((item, index) => jsonEquals(item, otherValue[index]));
|
|
392
|
+
}
|
|
393
|
+
if (Array.isArray(otherValue)) {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
const valueKeys = Object.keys(value);
|
|
397
|
+
const otherValueKeys = Object.keys(otherValue);
|
|
398
|
+
if (valueKeys.length !== otherValueKeys.length) {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
return valueKeys.every((key) => {
|
|
402
|
+
const subValue = value[key];
|
|
403
|
+
const subOtherValue = otherValue[key];
|
|
404
|
+
return jsonEquals(subValue, subOtherValue);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
__name(jsonEquals, "jsonEquals");
|
|
408
|
+
function jsonContains(value, otherValue) {
|
|
409
|
+
if (isPrimitiveJSONValue(value)) {
|
|
410
|
+
return value === otherValue;
|
|
411
|
+
}
|
|
412
|
+
if (isPrimitiveJSONValue(otherValue)) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
if (Array.isArray(value)) {
|
|
416
|
+
if (!Array.isArray(otherValue)) {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
if (value.length < otherValue.length) {
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
let lastMatchedIndex = -1;
|
|
423
|
+
return otherValue.every((otherItem) => {
|
|
424
|
+
for (let index = lastMatchedIndex + 1; index < value.length; index++) {
|
|
425
|
+
if (jsonContains(value[index], otherItem)) {
|
|
426
|
+
lastMatchedIndex = index;
|
|
427
|
+
return true;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return false;
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
if (Array.isArray(otherValue)) {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
const valueKeys = Object.keys(value);
|
|
437
|
+
const otherValueKeys = Object.keys(otherValue);
|
|
438
|
+
if (valueKeys.length < otherValueKeys.length) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
return otherValueKeys.every((key) => {
|
|
442
|
+
const subValue = value[key];
|
|
443
|
+
const subOtherValue = otherValue[key];
|
|
444
|
+
return jsonContains(subValue, subOtherValue);
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
__name(jsonContains, "jsonContains");
|
|
448
|
+
|
|
449
|
+
// src/http/requestHandler/errors/NoResponseDefinitionError.ts
|
|
450
|
+
var NoResponseDefinitionError = class extends TypeError {
|
|
451
|
+
static {
|
|
452
|
+
__name(this, "NoResponseDefinitionError");
|
|
453
|
+
}
|
|
454
|
+
constructor() {
|
|
455
|
+
super("Cannot generate a response without a definition. Use .respond() to set a response.");
|
|
456
|
+
this.name = "NoResponseDefinitionError";
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
var NoResponseDefinitionError_default = NoResponseDefinitionError;
|
|
460
|
+
|
|
375
461
|
// src/http/requestHandler/errors/TimesDeclarationPointer.ts
|
|
376
462
|
var TimesDeclarationPointer = class extends Error {
|
|
377
463
|
static {
|
|
@@ -787,30 +873,6 @@ var DEFAULT_UNHANDLED_REQUEST_STRATEGY = Object.freeze({
|
|
|
787
873
|
})
|
|
788
874
|
});
|
|
789
875
|
|
|
790
|
-
// src/http/interceptorWorker/errors/InvalidFormDataError.ts
|
|
791
|
-
var InvalidFormDataError = class extends SyntaxError {
|
|
792
|
-
static {
|
|
793
|
-
__name(this, "InvalidFormDataError");
|
|
794
|
-
}
|
|
795
|
-
constructor(value) {
|
|
796
|
-
super(`Failed to parse value as form data: ${value}`);
|
|
797
|
-
this.name = "InvalidFormDataError";
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
var InvalidFormDataError_default = InvalidFormDataError;
|
|
801
|
-
|
|
802
|
-
// src/http/interceptorWorker/errors/InvalidJSONError.ts
|
|
803
|
-
var InvalidJSONError = class extends SyntaxError {
|
|
804
|
-
static {
|
|
805
|
-
__name(this, "InvalidJSONError");
|
|
806
|
-
}
|
|
807
|
-
constructor(value) {
|
|
808
|
-
super(`Failed to parse value as JSON: ${value}`);
|
|
809
|
-
this.name = "InvalidJSONError";
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
var InvalidJSONError_default = InvalidJSONError;
|
|
813
|
-
|
|
814
876
|
// src/http/interceptorWorker/HttpInterceptorWorker.ts
|
|
815
877
|
var HttpInterceptorWorker = class _HttpInterceptorWorker {
|
|
816
878
|
static {
|
|
@@ -1165,58 +1227,6 @@ function validateURLPathParams(url) {
|
|
|
1165
1227
|
__name(validateURLPathParams, "validateURLPathParams");
|
|
1166
1228
|
__name2(validateURLPathParams, "validateURLPathParams");
|
|
1167
1229
|
var validateURLPathParams_default = validateURLPathParams;
|
|
1168
|
-
|
|
1169
|
-
// src/http/interceptor/errors/NotRunningHttpInterceptorError.ts
|
|
1170
|
-
var NotRunningHttpInterceptorError = class extends Error {
|
|
1171
|
-
static {
|
|
1172
|
-
__name(this, "NotRunningHttpInterceptorError");
|
|
1173
|
-
}
|
|
1174
|
-
constructor() {
|
|
1175
|
-
super("Interceptor is not running. Did you forget to call `await interceptor.start()`?");
|
|
1176
|
-
this.name = "NotRunningHttpInterceptorError";
|
|
1177
|
-
}
|
|
1178
|
-
};
|
|
1179
|
-
var NotRunningHttpInterceptorError_default = NotRunningHttpInterceptorError;
|
|
1180
|
-
|
|
1181
|
-
// src/http/interceptor/errors/UnknownHttpInterceptorPlatformError.ts
|
|
1182
|
-
var UnknownHttpInterceptorPlatformError = class extends Error {
|
|
1183
|
-
static {
|
|
1184
|
-
__name(this, "UnknownHttpInterceptorPlatformError");
|
|
1185
|
-
}
|
|
1186
|
-
/* istanbul ignore next -- @preserve
|
|
1187
|
-
* Ignoring because checking unknown platforms is currently not possible in our Vitest setup. */
|
|
1188
|
-
constructor() {
|
|
1189
|
-
super("Unknown interceptor platform.");
|
|
1190
|
-
this.name = "UnknownHttpInterceptorPlatform";
|
|
1191
|
-
}
|
|
1192
|
-
};
|
|
1193
|
-
var UnknownHttpInterceptorPlatformError_default = UnknownHttpInterceptorPlatformError;
|
|
1194
|
-
|
|
1195
|
-
// src/cli/browser/shared/constants.ts
|
|
1196
|
-
var SERVICE_WORKER_FILE_NAME = "mockServiceWorker.js";
|
|
1197
|
-
|
|
1198
|
-
// src/http/interceptorWorker/errors/UnregisteredBrowserServiceWorkerError.ts
|
|
1199
|
-
var UnregisteredBrowserServiceWorkerError = class extends Error {
|
|
1200
|
-
static {
|
|
1201
|
-
__name(this, "UnregisteredBrowserServiceWorkerError");
|
|
1202
|
-
}
|
|
1203
|
-
constructor() {
|
|
1204
|
-
super(
|
|
1205
|
-
`Failed to register the browser service worker: script '${window.location.origin}/${SERVICE_WORKER_FILE_NAME}' not found.
|
|
1206
|
-
|
|
1207
|
-
Did you forget to run \`zimic-interceptor browser init <publicDirectory>\`?
|
|
1208
|
-
|
|
1209
|
-
Learn more: https://github.com/zimicjs/zimic/wiki/getting\u2010started#client-side-post-install`
|
|
1210
|
-
);
|
|
1211
|
-
this.name = "UnregisteredBrowserServiceWorkerError";
|
|
1212
|
-
}
|
|
1213
|
-
static matchesRawError(error) {
|
|
1214
|
-
return error instanceof Error && error.message.toLowerCase().includes("service worker script does not exist at the given path");
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
var UnregisteredBrowserServiceWorkerError_default = UnregisteredBrowserServiceWorkerError;
|
|
1218
|
-
|
|
1219
|
-
// src/http/interceptorWorker/LocalHttpInterceptorWorker.ts
|
|
1220
1230
|
var LocalHttpInterceptorWorker = class extends HttpInterceptorWorker_default {
|
|
1221
1231
|
static {
|
|
1222
1232
|
__name(this, "LocalHttpInterceptorWorker");
|
|
@@ -1474,18 +1484,6 @@ var RemoteHttpRequestHandler = class {
|
|
|
1474
1484
|
};
|
|
1475
1485
|
var RemoteHttpRequestHandler_default = RemoteHttpRequestHandler;
|
|
1476
1486
|
|
|
1477
|
-
// src/http/interceptor/errors/RunningHttpInterceptorError.ts
|
|
1478
|
-
var RunningHttpInterceptorError = class extends Error {
|
|
1479
|
-
static {
|
|
1480
|
-
__name(this, "RunningHttpInterceptorError");
|
|
1481
|
-
}
|
|
1482
|
-
constructor(additionalMessage) {
|
|
1483
|
-
super(`The interceptor is running.${additionalMessage}`);
|
|
1484
|
-
this.name = "RunningHttpInterceptorError";
|
|
1485
|
-
}
|
|
1486
|
-
};
|
|
1487
|
-
var RunningHttpInterceptorError_default = RunningHttpInterceptorError;
|
|
1488
|
-
|
|
1489
1487
|
// src/http/interceptor/HttpInterceptorClient.ts
|
|
1490
1488
|
var SUPPORTED_BASE_URL_PROTOCOLS = Object.freeze(["http", "https"]);
|
|
1491
1489
|
var HttpInterceptorClient = class {
|
|
@@ -2590,27 +2588,6 @@ function createHttpInterceptor(options) {
|
|
|
2590
2588
|
throw new UnknownHttpInterceptorTypeError_default(type);
|
|
2591
2589
|
}
|
|
2592
2590
|
__name(createHttpInterceptor, "createHttpInterceptor");
|
|
2593
|
-
|
|
2594
|
-
// src/http/namespace/HttpInterceptorNamespace.ts
|
|
2595
|
-
var HttpInterceptorNamespace = class {
|
|
2596
|
-
static {
|
|
2597
|
-
__name(this, "HttpInterceptorNamespace");
|
|
2598
|
-
}
|
|
2599
|
-
/**
|
|
2600
|
-
* Creates an HTTP interceptor.
|
|
2601
|
-
*
|
|
2602
|
-
* @param options The options for the interceptor.
|
|
2603
|
-
* @returns The created HTTP interceptor.
|
|
2604
|
-
* @throws {InvalidURLError} If the base URL is invalid.
|
|
2605
|
-
* @throws {UnsupportedURLProtocolError} If the base URL protocol is not either `http` or `https`.
|
|
2606
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `httpInterceptor.create(options)` API reference}
|
|
2607
|
-
*/
|
|
2608
|
-
create = createHttpInterceptor;
|
|
2609
|
-
};
|
|
2610
|
-
var HttpInterceptorNamespace_default = HttpInterceptorNamespace;
|
|
2611
|
-
|
|
2612
|
-
// src/http/index.ts
|
|
2613
|
-
var httpInterceptor = Object.freeze(new HttpInterceptorNamespace_default());
|
|
2614
2591
|
/* istanbul ignore else -- @preserve */
|
|
2615
2592
|
/* istanbul ignore next -- @preserve
|
|
2616
2593
|
* Ignoring because checking unknown platforms is not configured in our test setup. */
|
|
@@ -2635,6 +2612,6 @@ exports.TimesCheckError = TimesCheckError_default;
|
|
|
2635
2612
|
exports.UnknownHttpInterceptorPlatformError = UnknownHttpInterceptorPlatformError_default;
|
|
2636
2613
|
exports.UnknownHttpInterceptorTypeError = UnknownHttpInterceptorTypeError_default;
|
|
2637
2614
|
exports.UnregisteredBrowserServiceWorkerError = UnregisteredBrowserServiceWorkerError_default;
|
|
2638
|
-
exports.
|
|
2615
|
+
exports.createHttpInterceptor = createHttpInterceptor;
|
|
2639
2616
|
//# sourceMappingURL=http.js.map
|
|
2640
2617
|
//# sourceMappingURL=http.js.map
|