backendless 7.4.1 → 7.4.2

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.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * ********************************************************************************************************************
3
- * Backendless SDK for JavaScript. Version: 7.4.1
3
+ * Backendless SDK for JavaScript. Version: 7.4.2
4
4
  *
5
5
  * Copyright 2012-2023 BACKENDLESS.COM. All Rights Reserved.
6
6
  *
@@ -12583,6 +12583,7 @@ exports.castArray = void 0;
12583
12583
  exports.ensureEncoding = ensureEncoding;
12584
12584
  exports.getFormData = getFormData;
12585
12585
  exports.isStream = exports.isObject = exports.isNodeJS = exports.isFormData = exports.isBrowser = void 0;
12586
+ exports.normalizeTrailingSlashInPath = normalizeTrailingSlashInPath;
12586
12587
  exports.setFormData = setFormData;
12587
12588
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12588
12589
  /**
@@ -12642,21 +12643,26 @@ function ensureComponentEncoding(uriComponent) {
12642
12643
  }
12643
12644
  return uriComponent;
12644
12645
  }
12645
- function encodePath(path, keepLastSlash) {
12646
- if (!keepLastSlash && path.endsWith('/')) {
12647
- path = path.slice(0, -1);
12648
- }
12646
+ function encodePath(path) {
12649
12647
  return path.split('/').map(ensureComponentEncoding).join('/');
12650
12648
  }
12651
12649
  function ensureEncoding(path) {
12652
12650
  try {
12653
12651
  var url = new URL(path);
12654
- var keepLastSlash = path.endsWith('/');
12655
- return url.origin + encodePath(url.pathname, keepLastSlash) + url.search;
12652
+ return url.origin + encodePath(normalizeTrailingSlashInPath(path, url)) + url.search;
12656
12653
  } catch (_unused) {
12657
12654
  return encodePath(path);
12658
12655
  }
12659
12656
  }
12657
+ function normalizeTrailingSlashInPath(originPath, _ref) {
12658
+ var pathname = _ref.pathname,
12659
+ search = _ref.search;
12660
+ if (search) {
12661
+ originPath = originPath.replace(search, '');
12662
+ }
12663
+ var keepTrailingSlash = originPath.endsWith('/');
12664
+ return !keepTrailingSlash && pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
12665
+ }
12660
12666
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
12661
12667
 
12662
12668
  /***/ }),
@@ -13070,13 +13076,11 @@ function sendNodeAPIRequest(path, method, headers, body, encoding, timeout, with
13070
13076
  return new Promise(function (resolve, reject) {
13071
13077
  var u = __webpack_require__(8).parse(path);
13072
13078
  var form = (0, _utils.isFormData)(body) && body;
13073
- var keepLastSlash = path.endsWith('/');
13074
- var pathname = !keepLastSlash && u.pathname.endsWith('/') ? u.pathname.slice(0, -1) : u.pathname;
13075
13079
  var https = u.protocol === 'https:';
13076
13080
  var options = {
13077
13081
  host: u.hostname,
13078
13082
  port: u.port || (https ? 443 : 80),
13079
- path: pathname + (u.search || ''),
13083
+ path: (0, _utils.normalizeTrailingSlashInPath)(path, u) + (u.search || ''),
13080
13084
  method: method,
13081
13085
  headers: headers,
13082
13086
  timeout: timeout