glitch-javascript-sdk 1.4.6 → 1.4.7

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)
@@ -5478,8 +5473,9 @@ var Requests = /** @class */ (function () {
5478
5473
  if (Requests.authToken) {
5479
5474
  headers['Authorization'] = "Bearer ".concat(Requests.authToken);
5480
5475
  }
5481
- // Construct the full URL properly
5482
- var uri = new URL(url, Requests.baseUrl).href;
5476
+ // Format URL
5477
+ url = url.replace(/\/\//g, '/');
5478
+ var uri = "".concat(Requests.baseUrl).concat(url).replace(/\/\//g, '/');
5483
5479
  // Make the request
5484
5480
  return axios$1({
5485
5481
  method: 'POST',
@@ -5496,9 +5492,6 @@ var Requests = /** @class */ (function () {
5496
5492
  return __generator(this, function (_a) {
5497
5493
  switch (_a.label) {
5498
5494
  case 0:
5499
- if (!uploadUrl.startsWith('/api')) {
5500
- uploadUrl = "/api".concat(uploadUrl);
5501
- }
5502
5495
  if (!chunkSize) {
5503
5496
  chunkSize = 1024 * 1024;
5504
5497
  }