@zauru-sdk/services 2.25.0 → 2.25.1

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.
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
14
  console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
15
- console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
+ let _bodyType;
16
+ let _bodyLog;
17
+ if (typeof FormData !== "undefined" && request.data instanceof FormData) {
18
+ _bodyType = "multipart/form-data";
19
+ const _entries = {};
20
+ request.data.forEach((value, key) => {
21
+ _entries[key] =
22
+ value instanceof Blob
23
+ ? `[Blob/File: ${value.name ?? "unnamed"}]`
24
+ : value;
25
+ });
26
+ _bodyLog = JSON.stringify(_entries, null, 2);
27
+ }
28
+ else if (typeof URLSearchParams !== "undefined" &&
29
+ request.data instanceof URLSearchParams) {
30
+ _bodyType = "application/x-www-form-urlencoded";
31
+ _bodyLog = request.data.toString();
32
+ }
33
+ else {
34
+ _bodyType = "application/json";
35
+ _bodyLog = JSON.stringify(request.data, null, 2);
36
+ }
37
+ console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
38
+ console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
16
39
  }
17
40
  return request;
18
41
  }, function (error) {
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
14
  console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
15
- console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
+ let _bodyType;
16
+ let _bodyLog;
17
+ if (typeof FormData !== "undefined" && request.data instanceof FormData) {
18
+ _bodyType = "multipart/form-data";
19
+ const _entries = {};
20
+ request.data.forEach((value, key) => {
21
+ _entries[key] =
22
+ value instanceof Blob
23
+ ? `[Blob/File: ${value.name ?? "unnamed"}]`
24
+ : value;
25
+ });
26
+ _bodyLog = JSON.stringify(_entries, null, 2);
27
+ }
28
+ else if (typeof URLSearchParams !== "undefined" &&
29
+ request.data instanceof URLSearchParams) {
30
+ _bodyType = "application/x-www-form-urlencoded";
31
+ _bodyLog = request.data.toString();
32
+ }
33
+ else {
34
+ _bodyType = "application/json";
35
+ _bodyLog = JSON.stringify(request.data, null, 2);
36
+ }
37
+ console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
38
+ console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
16
39
  }
17
40
  return request;
18
41
  }, function (error) {
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
14
  console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
15
- console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
+ let _bodyType;
16
+ let _bodyLog;
17
+ if (typeof FormData !== "undefined" && request.data instanceof FormData) {
18
+ _bodyType = "multipart/form-data";
19
+ const _entries = {};
20
+ request.data.forEach((value, key) => {
21
+ _entries[key] =
22
+ value instanceof Blob
23
+ ? `[Blob/File: ${value.name ?? "unnamed"}]`
24
+ : value;
25
+ });
26
+ _bodyLog = JSON.stringify(_entries, null, 2);
27
+ }
28
+ else if (typeof URLSearchParams !== "undefined" &&
29
+ request.data instanceof URLSearchParams) {
30
+ _bodyType = "application/x-www-form-urlencoded";
31
+ _bodyLog = request.data.toString();
32
+ }
33
+ else {
34
+ _bodyType = "application/json";
35
+ _bodyLog = JSON.stringify(request.data, null, 2);
36
+ }
37
+ console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
38
+ console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
16
39
  }
17
40
  return request;
18
41
  }, function (error) {
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
14
  console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
15
- console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
+ let _bodyType;
16
+ let _bodyLog;
17
+ if (typeof FormData !== "undefined" && request.data instanceof FormData) {
18
+ _bodyType = "multipart/form-data";
19
+ const _entries = {};
20
+ request.data.forEach((value, key) => {
21
+ _entries[key] =
22
+ value instanceof Blob
23
+ ? `[Blob/File: ${value.name ?? "unnamed"}]`
24
+ : value;
25
+ });
26
+ _bodyLog = JSON.stringify(_entries, null, 2);
27
+ }
28
+ else if (typeof URLSearchParams !== "undefined" &&
29
+ request.data instanceof URLSearchParams) {
30
+ _bodyType = "application/x-www-form-urlencoded";
31
+ _bodyLog = request.data.toString();
32
+ }
33
+ else {
34
+ _bodyType = "application/json";
35
+ _bodyLog = JSON.stringify(request.data, null, 2);
36
+ }
37
+ console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
38
+ console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
16
39
  }
17
40
  return request;
18
41
  }, function (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "2.25.0",
3
+ "version": "2.25.1",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -32,5 +32,5 @@
32
32
  "axios": "^1.6.7",
33
33
  "chalk": "5.3.0"
34
34
  },
35
- "gitHead": "da550f653a8f3439364198939bb2fc1e3aeb2752"
35
+ "gitHead": "cd45bdf2a9db53b3e5e8c118be5a34f66a30d588"
36
36
  }