@livechat/developer-studio-api 3.1.8 → 3.1.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/index.js CHANGED
@@ -225,8 +225,9 @@ var ApiClient = class {
225
225
  Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
226
226
  } : void 0)
227
227
  }));
228
+ const responseText = yield response.text();
228
229
  if (!response.ok) {
229
- const errorData = yield response.json();
230
+ const errorData = responseText ? JSON.parse(responseText) : {};
230
231
  const error = new this.Error(
231
232
  (_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
232
233
  errorData,
@@ -237,7 +238,7 @@ var ApiClient = class {
237
238
  }
238
239
  throw error;
239
240
  }
240
- const data = yield response.json();
241
+ const data = responseText ? JSON.parse(responseText) : {};
241
242
  return __spreadProps(__spreadValues({}, response), {
242
243
  data
243
244
  });
package/dist/index.mjs CHANGED
@@ -95,8 +95,9 @@ var ApiClient = class {
95
95
  Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
96
96
  } : void 0)
97
97
  }));
98
+ const responseText = yield response.text();
98
99
  if (!response.ok) {
99
- const errorData = yield response.json();
100
+ const errorData = responseText ? JSON.parse(responseText) : {};
100
101
  const error = new this.Error(
101
102
  (_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
102
103
  errorData,
@@ -107,7 +108,7 @@ var ApiClient = class {
107
108
  }
108
109
  throw error;
109
110
  }
110
- const data = yield response.json();
111
+ const data = responseText ? JSON.parse(responseText) : {};
111
112
  return __spreadProps(__spreadValues({}, response), {
112
113
  data
113
114
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.1.8",
3
+ "version": "3.1.9",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,9 +20,9 @@
20
20
  "@types/node": "^17.0.12",
21
21
  "tsup": "^7.1.0",
22
22
  "typescript": "^5.1.6",
23
- "eslint-config-custom": "0.0.8",
23
+ "utils": "0.0.4",
24
24
  "tsconfig": "0.0.1",
25
- "utils": "0.0.4"
25
+ "eslint-config-custom": "0.0.8"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsup",