@supabase/storage-js 2.102.0-canary.2 → 2.102.0-canary.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.
package/dist/index.cjs CHANGED
@@ -288,12 +288,22 @@ const _getRequestParams = (method, options, parameters, body) => {
288
288
  };
289
289
  if (method === "GET" || method === "HEAD" || !body) return _objectSpread2(_objectSpread2({}, params), parameters);
290
290
  if (isPlainObject(body)) {
291
- params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
291
+ var _contentType;
292
+ const headers = (options === null || options === void 0 ? void 0 : options.headers) || {};
293
+ let contentType;
294
+ for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "content-type") contentType = value;
295
+ params.headers = setRequestHeader(headers, "Content-Type", (_contentType = contentType) !== null && _contentType !== void 0 ? _contentType : "application/json");
292
296
  params.body = JSON.stringify(body);
293
297
  } else params.body = body;
294
298
  if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
295
299
  return _objectSpread2(_objectSpread2({}, params), parameters);
296
300
  };
301
+ function setRequestHeader(headers, name, value) {
302
+ const nextHeaders = _objectSpread2({}, headers);
303
+ for (const key of Object.keys(nextHeaders)) if (key.toLowerCase() === name.toLowerCase()) delete nextHeaders[key];
304
+ nextHeaders[name] = value;
305
+ return nextHeaders;
306
+ }
297
307
  /**
298
308
  * Internal request handler that wraps fetch with error handling
299
309
  * @param fetcher - Fetch function to use
@@ -1432,7 +1442,7 @@ var StorageFileApi = class extends BaseApiClient {
1432
1442
 
1433
1443
  //#endregion
1434
1444
  //#region src/lib/version.ts
1435
- const version = "2.102.0-canary.2";
1445
+ const version = "2.102.0-canary.4";
1436
1446
 
1437
1447
  //#endregion
1438
1448
  //#region src/lib/constants.ts