@zimic/interceptor 0.16.0-canary.7 → 0.16.0-canary.9
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-NY62MKKU.mjs → chunk-NTRC2S4I.mjs} +5 -5
- package/dist/chunk-NTRC2S4I.mjs.map +1 -0
- package/dist/{chunk-HYJ5EZ6I.js → chunk-O6ZIPCUJ.js} +6 -6
- package/dist/chunk-O6ZIPCUJ.js.map +1 -0
- package/dist/cli.js +9 -9
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/cli.mjs.map +1 -1
- package/dist/http.js +14 -14
- package/dist/http.js.map +1 -1
- package/dist/http.mjs +13 -13
- package/dist/http.mjs.map +1 -1
- package/dist/server.js +6 -6
- package/dist/server.mjs +1 -1
- package/package.json +5 -5
- package/src/cli/browser/init.ts +2 -2
- package/src/http/interceptorWorker/HttpInterceptorWorker.ts +2 -2
- package/src/http/requestHandler/errors/TimesCheckError.ts +10 -10
- package/src/utils/console.ts +2 -2
- package/dist/chunk-HYJ5EZ6I.js.map +0 -1
- package/dist/chunk-NY62MKKU.mjs.map +0 -1
package/dist/http.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var color2 = require('picocolors');
|
|
4
4
|
var http = require('@zimic/http');
|
|
5
5
|
var msw = require('msw');
|
|
6
6
|
var mswBrowser = require('msw/browser');
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
return Object.freeze(n);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var color2__default = /*#__PURE__*/_interopDefault(color2);
|
|
31
31
|
var mswBrowser__namespace = /*#__PURE__*/_interopNamespace(mswBrowser);
|
|
32
32
|
var mswNode__namespace = /*#__PURE__*/_interopNamespace(mswNode);
|
|
33
33
|
var ClientSocket__default = /*#__PURE__*/_interopDefault(ClientSocket);
|
|
@@ -275,7 +275,7 @@ __name(formatValueToLog, "formatValueToLog");
|
|
|
275
275
|
function logWithPrefix(messageOrMessages, options = {}) {
|
|
276
276
|
const { method = "log" } = options;
|
|
277
277
|
const messages = Array.isArray(messageOrMessages) ? messageOrMessages : [messageOrMessages];
|
|
278
|
-
console[method](
|
|
278
|
+
console[method](color2__default.default.cyan("[@zimic/interceptor]"), ...messages);
|
|
279
279
|
}
|
|
280
280
|
__name(logWithPrefix, "logWithPrefix");
|
|
281
281
|
|
|
@@ -301,8 +301,8 @@ function createMessageHeader({
|
|
|
301
301
|
|
|
302
302
|
Requests evaluated by this handler:
|
|
303
303
|
|
|
304
|
-
${
|
|
305
|
-
${
|
|
304
|
+
${color2__default.default.green("- Expected")}
|
|
305
|
+
${color2__default.default.red("+ Received")}`
|
|
306
306
|
].filter((part) => part !== false).join("");
|
|
307
307
|
}
|
|
308
308
|
__name(createMessageHeader, "createMessageHeader");
|
|
@@ -317,22 +317,22 @@ function createMessageDiffs({ requestSaving, unmatchedRequestGroups }) {
|
|
|
317
317
|
messageParts.push("Computed restriction:");
|
|
318
318
|
const stringifiedExpected = stringifyValueToLog(diff.computed.expected);
|
|
319
319
|
const stringifiedReceived = stringifyValueToLog(diff.computed.received);
|
|
320
|
-
messageParts.push(` ${
|
|
321
|
-
messageParts.push(` ${
|
|
320
|
+
messageParts.push(` ${color2__default.default.green(`- return ${stringifiedExpected}`)}`);
|
|
321
|
+
messageParts.push(` ${color2__default.default.red(`+ return ${stringifiedReceived}`)}`);
|
|
322
322
|
}
|
|
323
323
|
if (diff.headers) {
|
|
324
324
|
messageParts.push("Headers:");
|
|
325
325
|
const stringifiedExpected = stringifyValueToLog(diff.headers.expected);
|
|
326
326
|
const stringifiedReceived = stringifyValueToLog(diff.headers.received);
|
|
327
|
-
messageParts.push(` ${
|
|
328
|
-
messageParts.push(` ${
|
|
327
|
+
messageParts.push(` ${color2__default.default.green(`- ${stringifiedExpected}`)}`);
|
|
328
|
+
messageParts.push(` ${color2__default.default.red(`+ ${stringifiedReceived}`)}`);
|
|
329
329
|
}
|
|
330
330
|
if (diff.searchParams) {
|
|
331
331
|
messageParts.push("Search params:");
|
|
332
332
|
const stringifiedExpected = stringifyValueToLog(diff.searchParams.expected);
|
|
333
333
|
const stringifiedReceived = stringifyValueToLog(diff.searchParams.received);
|
|
334
|
-
messageParts.push(` ${
|
|
335
|
-
messageParts.push(` ${
|
|
334
|
+
messageParts.push(` ${color2__default.default.green(`- ${stringifiedExpected}`)}`);
|
|
335
|
+
messageParts.push(` ${color2__default.default.red(`+ ${stringifiedReceived}`)}`);
|
|
336
336
|
}
|
|
337
337
|
if (diff.body) {
|
|
338
338
|
messageParts.push("Body:");
|
|
@@ -342,8 +342,8 @@ function createMessageDiffs({ requestSaving, unmatchedRequestGroups }) {
|
|
|
342
342
|
const stringifiedReceived = stringifyValueToLog(diff.body.received, {
|
|
343
343
|
includeClassName: { searchParams: true }
|
|
344
344
|
});
|
|
345
|
-
messageParts.push(` ${
|
|
346
|
-
messageParts.push(` ${
|
|
345
|
+
messageParts.push(` ${color2__default.default.green(`- ${stringifiedExpected}`)}`);
|
|
346
|
+
messageParts.push(` ${color2__default.default.red(`+ ${stringifiedReceived}`)}`);
|
|
347
347
|
}
|
|
348
348
|
return messageParts.join("\n ");
|
|
349
349
|
}).join("\n\n");
|
|
@@ -1204,7 +1204,7 @@ var HttpInterceptorWorker = class _HttpInterceptorWorker {
|
|
|
1204
1204
|
]);
|
|
1205
1205
|
logWithPrefix(
|
|
1206
1206
|
[
|
|
1207
|
-
`${action === "bypass" ? "Warning:" : "Error:"} Request was not handled and was ${action === "bypass" ?
|
|
1207
|
+
`${action === "bypass" ? "Warning:" : "Error:"} Request was not handled and was ${action === "bypass" ? color2__default.default.yellow("bypassed") : color2__default.default.red("rejected")}.
|
|
1208
1208
|
|
|
1209
1209
|
`,
|
|
1210
1210
|
`${request.method} ${request.url}`,
|