@unboundcx/sdk 2.6.3 → 2.6.4

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.
Files changed (2) hide show
  1. package/base.js +13 -1
  2. package/package.json +1 -1
package/base.js CHANGED
@@ -292,7 +292,19 @@ export class BaseSDK {
292
292
  }
293
293
 
294
294
  const response = await fetch(url, options);
295
- const bodyResponse = await response.json();
295
+
296
+ // Check content type to determine how to parse the response
297
+ const contentType = response.headers.get('content-type') || '';
298
+ let bodyResponse;
299
+
300
+ if (contentType.includes('application/json')) {
301
+ bodyResponse = await response.json();
302
+ } else if (contentType.includes('text/')) {
303
+ bodyResponse = await response.text();
304
+ } else {
305
+ // For binary content (PDFs, images, etc), return as ArrayBuffer
306
+ bodyResponse = await response.arrayBuffer();
307
+ }
296
308
 
297
309
  const responseHeaders = response.headers;
298
310
  const responseRequestId =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",