rest-client-sdk 7.0.0-rc.3 → 7.0.0-rc.5

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");
@@ -1219,6 +1255,36 @@ var HttpError = /*#__PURE__*/function (_Error) {
1219
1255
  _this.baseResponse = baseResponse;
1220
1256
  return _this;
1221
1257
  }
1258
+ /**
1259
+ * Get the JSON of the baseResponse directly, if possible
1260
+ */
1261
+
1262
+
1263
+ _createClass(HttpError, [{
1264
+ key: "responseJson",
1265
+ value: function () {
1266
+ var _responseJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
1267
+ return regeneratorRuntime.wrap(function _callee$(_context) {
1268
+ while (1) {
1269
+ switch (_context.prev = _context.next) {
1270
+ case 0:
1271
+ return _context.abrupt("return", this.baseResponse.json());
1272
+
1273
+ case 1:
1274
+ case "end":
1275
+ return _context.stop();
1276
+ }
1277
+ }
1278
+ }, _callee, this);
1279
+ }));
1280
+
1281
+ function responseJson() {
1282
+ return _responseJson.apply(this, arguments);
1283
+ }
1284
+
1285
+ return responseJson;
1286
+ }()
1287
+ }]);
1222
1288
 
1223
1289
  return HttpError;
1224
1290
  }( /*#__PURE__*/_wrapNativeSuper(Error));