glitch-javascript-sdk 1.4.6 → 1.4.8

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/esm/index.js CHANGED
@@ -5431,14 +5431,12 @@ var Requests = /** @class */ (function () {
5431
5431
  formData.append(key, data[key]);
5432
5432
  }
5433
5433
  // Prepare headers
5434
- var headers = {
5435
- 'Content-Type': 'multipart/form-data',
5436
- };
5434
+ var headers = {};
5437
5435
  if (Requests.authToken) {
5438
5436
  headers['Authorization'] = "Bearer ".concat(Requests.authToken);
5439
5437
  }
5440
- // Construct the full URL properly
5441
- var uri = new URL(url, Requests.baseUrl).href;
5438
+ // Format URL correctly
5439
+ var uri = Requests.baseUrl.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
5442
5440
  // Make the request
5443
5441
  return axios$1({
5444
5442
  method: 'POST',
@@ -5449,9 +5447,6 @@ var Requests = /** @class */ (function () {
5449
5447
  });
5450
5448
  };
5451
5449
  Requests.uploadBlob = function (url, filename, blob, data, params, onUploadProgress) {
5452
- if (!url.startsWith('/api')) {
5453
- url = "/api".concat(url);
5454
- }
5455
5450
  // Process URL and params
5456
5451
  if (params && Object.keys(params).length > 0) {
5457
5452
  var queryString = Object.entries(params)
@@ -5472,14 +5467,12 @@ var Requests = /** @class */ (function () {
5472
5467
  formData.append(key, data[key]);
5473
5468
  }
5474
5469
  // Prepare headers
5475
- var headers = {
5476
- 'Content-Type': 'multipart/form-data',
5477
- };
5470
+ var headers = {};
5478
5471
  if (Requests.authToken) {
5479
5472
  headers['Authorization'] = "Bearer ".concat(Requests.authToken);
5480
5473
  }
5481
- // Construct the full URL properly
5482
- var uri = new URL(url, Requests.baseUrl).href;
5474
+ // Format URL correctly
5475
+ var uri = Requests.baseUrl.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
5483
5476
  // Make the request
5484
5477
  return axios$1({
5485
5478
  method: 'POST',
@@ -5496,9 +5489,6 @@ var Requests = /** @class */ (function () {
5496
5489
  return __generator(this, function (_a) {
5497
5490
  switch (_a.label) {
5498
5491
  case 0:
5499
- if (!uploadUrl.startsWith('/api')) {
5500
- uploadUrl = "/api".concat(uploadUrl);
5501
- }
5502
5492
  if (!chunkSize) {
5503
5493
  chunkSize = 1024 * 1024;
5504
5494
  }