@vtex/api
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
@@ -95,8 +97,23 @@ | ||
if (err) { | ||
return reject(err); | ||
return reject(res); | ||
} | ||
// Publish response has an empty payload, no need to read stream. | ||
if (!(0, _http.successful)(res.statusCode)) { | ||
return reject(res); | ||
var _ret = function () { | ||
var data = ''; | ||
res.on('data', function (c) { | ||
return data += c; | ||
}); // eslint-disable-line | ||
res.on('end', function () { | ||
var error = new _http.StatusCodeError(res.statusCode, res.statusMessage, res); | ||
error.error = data; | ||
reject(error); | ||
}); | ||
return { | ||
v: void 0 | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
} | ||
// Publish response has an empty payload, no need to read stream. | ||
resolve(res); | ||
@@ -103,0 +120,0 @@ }); |
{ | ||
"name": "@vtex/api", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "VTEX I/O API client", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
35909
734