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/cjs/index.js CHANGED
@@ -18615,14 +18615,12 @@ var Requests = /** @class */ (function () {
18615
18615
  formData.append(key, data[key]);
18616
18616
  }
18617
18617
  // Prepare headers
18618
- var headers = {
18619
- 'Content-Type': 'multipart/form-data',
18620
- };
18618
+ var headers = {};
18621
18619
  if (Requests.authToken) {
18622
18620
  headers['Authorization'] = "Bearer ".concat(Requests.authToken);
18623
18621
  }
18624
- // Construct the full URL properly
18625
- var uri = new URL(url, Requests.baseUrl).href;
18622
+ // Format URL correctly
18623
+ var uri = Requests.baseUrl.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
18626
18624
  // Make the request
18627
18625
  return axios$1({
18628
18626
  method: 'POST',
@@ -18633,9 +18631,6 @@ var Requests = /** @class */ (function () {
18633
18631
  });
18634
18632
  };
18635
18633
  Requests.uploadBlob = function (url, filename, blob, data, params, onUploadProgress) {
18636
- if (!url.startsWith('/api')) {
18637
- url = "/api".concat(url);
18638
- }
18639
18634
  // Process URL and params
18640
18635
  if (params && Object.keys(params).length > 0) {
18641
18636
  var queryString = Object.entries(params)
@@ -18662,8 +18657,9 @@ var Requests = /** @class */ (function () {
18662
18657
  if (Requests.authToken) {
18663
18658
  headers['Authorization'] = "Bearer ".concat(Requests.authToken);
18664
18659
  }
18665
- // Construct the full URL properly
18666
- var uri = new URL(url, Requests.baseUrl).href;
18660
+ // Format URL
18661
+ url = url.replace(/\/\//g, '/');
18662
+ var uri = "".concat(Requests.baseUrl).concat(url).replace(/\/\//g, '/');
18667
18663
  // Make the request
18668
18664
  return axios$1({
18669
18665
  method: 'POST',
@@ -18680,9 +18676,6 @@ var Requests = /** @class */ (function () {
18680
18676
  return __generator(this, function (_a) {
18681
18677
  switch (_a.label) {
18682
18678
  case 0:
18683
- if (!uploadUrl.startsWith('/api')) {
18684
- uploadUrl = "/api".concat(uploadUrl);
18685
- }
18686
18679
  if (!chunkSize) {
18687
18680
  chunkSize = 1024 * 1024;
18688
18681
  }