@xrystal/core 3.9.8 → 3.9.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.9.8",
4
+ "version": "3.9.9",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -106,16 +106,20 @@ export class BaseApiClient extends Client {
106
106
  }
107
107
  const isDebugMode = options.debug !== undefined ? options.debug : this.debug;
108
108
  if (isDebugMode) {
109
- this.logger.winston.info(`${this.clientName} Request Details`, {
109
+ const logPayload = {
110
110
  method: options.method || 'GET',
111
111
  url,
112
112
  headers: Object.fromEntries(headers.entries()),
113
- body: options.body ? (typeof options.body === 'string' ? JSON.parse(options.body) : 'Data') : null
114
- });
113
+ body: options.body ? (typeof options.body === 'string' ? JSON.parse(options.body) : options.body) : null
114
+ };
115
+ this.logger.winston.info(`${this.clientName} Request Details: ${JSON.stringify(logPayload, null, 2)}`);
115
116
  }
116
117
  const controller = new AbortController();
117
118
  const timeoutId = setTimeout(() => controller.abort(), this.timeout);
118
119
  const { version, retries, debug, ...fetchOptions } = options;
120
+ if (fetchOptions.body && typeof fetchOptions.body === 'object') {
121
+ fetchOptions.body = JSON.stringify(fetchOptions.body);
122
+ }
119
123
  const response = await fetch(url, { ...fetchOptions, headers, signal: controller.signal });
120
124
  clearTimeout(timeoutId);
121
125
  return response;