backendless 7.4.0 → 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.0
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
  /**
@@ -12643,19 +12644,25 @@ function ensureComponentEncoding(uriComponent) {
12643
12644
  return uriComponent;
12644
12645
  }
12645
12646
  function encodePath(path) {
12646
- if (path.endsWith('/')) {
12647
- path = path.slice(0, -1);
12648
- }
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
- return url.origin + encodePath(url.pathname) + url.search;
12652
+ return url.origin + encodePath(normalizeTrailingSlashInPath(path, url)) + url.search;
12655
12653
  } catch (_unused) {
12656
12654
  return encodePath(path);
12657
12655
  }
12658
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
+ }
12659
12666
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
12660
12667
 
12661
12668
  /***/ }),
@@ -13069,12 +13076,11 @@ function sendNodeAPIRequest(path, method, headers, body, encoding, timeout, with
13069
13076
  return new Promise(function (resolve, reject) {
13070
13077
  var u = __webpack_require__(8).parse(path);
13071
13078
  var form = (0, _utils.isFormData)(body) && body;
13072
- var pathname = u.pathname.endsWith('/') ? u.pathname.slice(0, -1) : u.pathname;
13073
13079
  var https = u.protocol === 'https:';
13074
13080
  var options = {
13075
13081
  host: u.hostname,
13076
13082
  port: u.port || (https ? 443 : 80),
13077
- path: pathname + (u.search || ''),
13083
+ path: (0, _utils.normalizeTrailingSlashInPath)(path, u) + (u.search || ''),
13078
13084
  method: method,
13079
13085
  headers: headers,
13080
13086
  timeout: timeout