@nmakarov/cli-toolkit 0.18.0 → 0.21.0

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.
@@ -1421,7 +1421,7 @@ var HttpClient = class _HttpClient {
1421
1421
  }
1422
1422
  }
1423
1423
  /**
1424
- * Static init - discovers params via context.params.getAllForModule("http-client2", defs). Whatever is in options goes.
1424
+ * Static init - discovers params via context.params.getAll(defs). Whatever is in options wins.
1425
1425
  */
1426
1426
  static init(context, options = {}) {
1427
1427
  const defs = {
@@ -1444,7 +1444,7 @@ var HttpClient = class _HttpClient {
1444
1444
  showMaxArrayItems: "number default 5",
1445
1445
  showMaxChars: "number default 300"
1446
1446
  };
1447
- const discovered = context?.params?.getAllForModule?.(defs) ?? {};
1447
+ const discovered = context?.params?.getAll?.(defs) ?? {};
1448
1448
  const merged = { ...discovered, ...options };
1449
1449
  if ((merged.saveMock || merged.useMock) && !merged.mocksPath) {
1450
1450
  throw new ParamError("[http-client2] mocksPath is required when saveMock or useMock is set");
@@ -1460,6 +1460,7 @@ var HttpClient = class _HttpClient {
1460
1460
  const retryCount = options.retryCount ?? this.config.retryCount ?? 3;
1461
1461
  const retryDelay = options.retryDelay ?? this.config.retryDelay ?? 1e3;
1462
1462
  let fullUrl = buildUrl(this.config.baseURL, url, options.params);
1463
+ console.info("!!!!!!!!!!!!!!!!!!!!!!");
1463
1464
  if (this.config.useMock && this.mockStorage) {
1464
1465
  try {
1465
1466
  const urlObj = new URL(fullUrl);
@@ -1532,6 +1533,8 @@ var HttpClient = class _HttpClient {
1532
1533
  clearTimeout(timeoutId);
1533
1534
  const duration = Date.now() - startTime;
1534
1535
  const resHeaders = headersToRecord(response.headers);
1536
+ console.info(">> fullUrl:", fullUrl);
1537
+ console.info(">> response:", response);
1535
1538
  if (response.ok) {
1536
1539
  const data2 = await parseBody(response);
1537
1540
  if (options.debug) {
@@ -1569,6 +1572,7 @@ var HttpClient = class _HttpClient {
1569
1572
  return result;
1570
1573
  }
1571
1574
  const data = await parseBody(response);
1575
+ console.info(">> something is wrong with the request/response:", data);
1572
1576
  const classification2 = classifyError({ response: { status: response.status, headers: resHeaders, data } });
1573
1577
  if (this.config.showResponse) {
1574
1578
  this.logRequestResponse(method, fullUrl, options, headers, { status: response.status, headers: resHeaders, data }, duration, false);