@findatruck/aggregator-client 1.4.0 → 1.4.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.
package/dist/index.cjs CHANGED
@@ -301,11 +301,12 @@ var AggregatorClient = class {
301
301
  body: JSON.stringify(body)
302
302
  });
303
303
  if (!response.ok) {
304
+ const text = await response.text();
304
305
  let responseBody;
305
306
  try {
306
- responseBody = await response.json();
307
+ responseBody = JSON.parse(text);
307
308
  } catch {
308
- responseBody = await response.text();
309
+ responseBody = text;
309
310
  }
310
311
  throw new AggregatorClientError(
311
312
  `Request to ${path} failed with status ${response.status}`,
@@ -331,11 +332,12 @@ var AggregatorClient = class {
331
332
  }
332
333
  });
333
334
  if (!response.ok) {
335
+ const text = await response.text();
334
336
  let responseBody;
335
337
  try {
336
- responseBody = await response.json();
338
+ responseBody = JSON.parse(text);
337
339
  } catch {
338
- responseBody = await response.text();
340
+ responseBody = text;
339
341
  }
340
342
  throw new AggregatorClientError(
341
343
  `Request to ${path} failed with status ${response.status}`,
package/dist/index.js CHANGED
@@ -267,11 +267,12 @@ var AggregatorClient = class {
267
267
  body: JSON.stringify(body)
268
268
  });
269
269
  if (!response.ok) {
270
+ const text = await response.text();
270
271
  let responseBody;
271
272
  try {
272
- responseBody = await response.json();
273
+ responseBody = JSON.parse(text);
273
274
  } catch {
274
- responseBody = await response.text();
275
+ responseBody = text;
275
276
  }
276
277
  throw new AggregatorClientError(
277
278
  `Request to ${path} failed with status ${response.status}`,
@@ -297,11 +298,12 @@ var AggregatorClient = class {
297
298
  }
298
299
  });
299
300
  if (!response.ok) {
301
+ const text = await response.text();
300
302
  let responseBody;
301
303
  try {
302
- responseBody = await response.json();
304
+ responseBody = JSON.parse(text);
303
305
  } catch {
304
- responseBody = await response.text();
306
+ responseBody = text;
305
307
  }
306
308
  throw new AggregatorClientError(
307
309
  `Request to ${path} failed with status ${response.status}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findatruck/aggregator-client",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",