rest-client-sdk 6.6.2 → 6.7.1

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/index.es.js CHANGED
@@ -17,6 +17,42 @@ function _typeof(obj) {
17
17
  return _typeof(obj);
18
18
  }
19
19
 
20
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
21
+ try {
22
+ var info = gen[key](arg);
23
+ var value = info.value;
24
+ } catch (error) {
25
+ reject(error);
26
+ return;
27
+ }
28
+
29
+ if (info.done) {
30
+ resolve(value);
31
+ } else {
32
+ Promise.resolve(value).then(_next, _throw);
33
+ }
34
+ }
35
+
36
+ function _asyncToGenerator(fn) {
37
+ return function () {
38
+ var self = this,
39
+ args = arguments;
40
+ return new Promise(function (resolve, reject) {
41
+ var gen = fn.apply(self, args);
42
+
43
+ function _next(value) {
44
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
45
+ }
46
+
47
+ function _throw(err) {
48
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
49
+ }
50
+
51
+ _next(undefined);
52
+ });
53
+ };
54
+ }
55
+
20
56
  function _classCallCheck(instance, Constructor) {
21
57
  if (!(instance instanceof Constructor)) {
22
58
  throw new TypeError("Cannot call a class as a function");
@@ -1064,6 +1100,36 @@ var HttpError = /*#__PURE__*/function (_Error) {
1064
1100
  _this.baseResponse = baseResponse;
1065
1101
  return _this;
1066
1102
  }
1103
+ /**
1104
+ * Get the JSON of the baseResponse directly, if possible
1105
+ */
1106
+
1107
+
1108
+ _createClass(HttpError, [{
1109
+ key: "responseJson",
1110
+ value: function () {
1111
+ var _responseJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
1112
+ return regeneratorRuntime.wrap(function _callee$(_context) {
1113
+ while (1) {
1114
+ switch (_context.prev = _context.next) {
1115
+ case 0:
1116
+ return _context.abrupt("return", this.baseResponse.json());
1117
+
1118
+ case 1:
1119
+ case "end":
1120
+ return _context.stop();
1121
+ }
1122
+ }
1123
+ }, _callee, this);
1124
+ }));
1125
+
1126
+ function responseJson() {
1127
+ return _responseJson.apply(this, arguments);
1128
+ }
1129
+
1130
+ return responseJson;
1131
+ }()
1132
+ }]);
1067
1133
 
1068
1134
  return HttpError;
1069
1135
  }( /*#__PURE__*/_wrapNativeSuper(Error));
@@ -1713,7 +1779,7 @@ var AbstractClient = /*#__PURE__*/function () {
1713
1779
  if (this.sdk.mapping.idPrefix) {
1714
1780
  var segments = url.segment();
1715
1781
 
1716
- if ("/".concat(segments[0]) !== this.sdk.mapping.idPrefix) {
1782
+ if (!url.pathname().startsWith(this.sdk.mapping.idPrefix)) {
1717
1783
  segments.unshift(this.sdk.mapping.idPrefix);
1718
1784
  url.segment(segments);
1719
1785
  }