@deliverart/sdk-js-core 2.3.9 → 2.4.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.
package/dist/index.cjs CHANGED
@@ -148,20 +148,24 @@ function createApiClient(config) {
148
148
  let response = await fetch(ctx.url.toString(), ctx.init);
149
149
  let contentType = response.headers.get("Content-Type") ?? "";
150
150
  let parsedBody;
151
- try {
152
- if (contentType.includes("application/")) {
153
- if (contentType.includes("json")) {
154
- parsedBody = await response.json();
155
- } else {
151
+ if (response.status === 204) {
152
+ parsedBody = null;
153
+ } else {
154
+ try {
155
+ if (contentType.includes("application/")) {
156
+ if (contentType.includes("json")) {
157
+ parsedBody = await response.json();
158
+ } else {
159
+ parsedBody = await response.text();
160
+ }
161
+ } else if (contentType.includes("text/")) {
156
162
  parsedBody = await response.text();
163
+ } else {
164
+ parsedBody = await response.arrayBuffer();
157
165
  }
158
- } else if (contentType.includes("text/")) {
159
- parsedBody = await response.text();
160
- } else {
161
- parsedBody = await response.arrayBuffer();
166
+ } catch (err) {
167
+ parsedBody = void 0;
162
168
  }
163
- } catch (err) {
164
- parsedBody = void 0;
165
169
  }
166
170
  let parsedResponse = {
167
171
  response,
package/dist/index.js CHANGED
@@ -109,20 +109,24 @@ function createApiClient(config) {
109
109
  let response = await fetch(ctx.url.toString(), ctx.init);
110
110
  let contentType = response.headers.get("Content-Type") ?? "";
111
111
  let parsedBody;
112
- try {
113
- if (contentType.includes("application/")) {
114
- if (contentType.includes("json")) {
115
- parsedBody = await response.json();
116
- } else {
112
+ if (response.status === 204) {
113
+ parsedBody = null;
114
+ } else {
115
+ try {
116
+ if (contentType.includes("application/")) {
117
+ if (contentType.includes("json")) {
118
+ parsedBody = await response.json();
119
+ } else {
120
+ parsedBody = await response.text();
121
+ }
122
+ } else if (contentType.includes("text/")) {
117
123
  parsedBody = await response.text();
124
+ } else {
125
+ parsedBody = await response.arrayBuffer();
118
126
  }
119
- } else if (contentType.includes("text/")) {
120
- parsedBody = await response.text();
121
- } else {
122
- parsedBody = await response.arrayBuffer();
127
+ } catch (err) {
128
+ parsedBody = void 0;
123
129
  }
124
- } catch (err) {
125
- parsedBody = void 0;
126
130
  }
127
131
  let parsedResponse = {
128
132
  response,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deliverart/sdk-js-core",
3
3
  "description": "Core SDK for DeliverArt, providing essential functionalities and utilities.",
4
- "version": "2.3.9",
4
+ "version": "2.4.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",