@scalemule/sdk 0.0.61 → 0.0.62

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/index.js CHANGED
@@ -1152,7 +1152,7 @@ var ScaleMuleClient = class {
1152
1152
  const method = (init.method || "GET").toUpperCase();
1153
1153
  const timeout = init.timeout || this.defaultTimeout;
1154
1154
  const maxRetries = init.skipRetry ? 0 : init.retries ?? this.maxRetries;
1155
- const bodyStr = init.body ? JSON.stringify(init.body) : void 0;
1155
+ const bodyStr = init.body !== void 0 && init.body !== null ? typeof init.body === "string" ? init.body : JSON.stringify(init.body) : void 0;
1156
1156
  let lastError = null;
1157
1157
  let idempotencyKey = null;
1158
1158
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
@@ -1161,6 +1161,9 @@ var ScaleMuleClient = class {
1161
1161
  "User-Agent": `ScaleMule-SDK-TypeScript/${SDK_VERSION}`,
1162
1162
  ...init.headers
1163
1163
  };
1164
+ if (bodyStr !== void 0 && !Object.keys(headers).some((k) => k.toLowerCase() === "content-type")) {
1165
+ headers["Content-Type"] = "application/json";
1166
+ }
1164
1167
  if (!init.skipAuth && this.sessionToken) {
1165
1168
  headers["Authorization"] = `Bearer ${this.sessionToken}`;
1166
1169
  }
package/dist/index.mjs CHANGED
@@ -1048,7 +1048,7 @@ var ScaleMuleClient = class {
1048
1048
  const method = (init.method || "GET").toUpperCase();
1049
1049
  const timeout = init.timeout || this.defaultTimeout;
1050
1050
  const maxRetries = init.skipRetry ? 0 : init.retries ?? this.maxRetries;
1051
- const bodyStr = init.body ? JSON.stringify(init.body) : void 0;
1051
+ const bodyStr = init.body !== void 0 && init.body !== null ? typeof init.body === "string" ? init.body : JSON.stringify(init.body) : void 0;
1052
1052
  let lastError = null;
1053
1053
  let idempotencyKey = null;
1054
1054
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
@@ -1057,6 +1057,9 @@ var ScaleMuleClient = class {
1057
1057
  "User-Agent": `ScaleMule-SDK-TypeScript/${SDK_VERSION}`,
1058
1058
  ...init.headers
1059
1059
  };
1060
+ if (bodyStr !== void 0 && !Object.keys(headers).some((k) => k.toLowerCase() === "content-type")) {
1061
+ headers["Content-Type"] = "application/json";
1062
+ }
1060
1063
  if (!init.skipAuth && this.sessionToken) {
1061
1064
  headers["Authorization"] = `Bearer ${this.sessionToken}`;
1062
1065
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/sdk",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "description": "Official TypeScript/JavaScript SDK for ScaleMule Backend-as-a-Service",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",