@highpoint/js-fetch
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,4 @@ | ||
# v1.0.1 | ||
* Throw exception on authorization errors | ||
# v1.0.0 | ||
@@ -2,0 +5,0 @@ * Add function to post raw, non-JSON content. |
@@ -31,3 +31,3 @@ 'use strict'; | ||
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(response) { | ||
var isOK; | ||
var isOK, responseText, authFailed; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -59,17 +59,29 @@ while (1) { | ||
case 7: | ||
_context.next = 9; | ||
return response.text(); | ||
case 9: | ||
responseText = _context.sent; | ||
if (!(response.ok && isOK)) { | ||
_context.next = 9; | ||
_context.next = 15; | ||
break; | ||
} | ||
return _context.abrupt('return', response.text()); | ||
authFailed = responseText.indexOf('Authorization Error') > -1; | ||
case 9: | ||
_context.next = 11; | ||
return response.text(); | ||
if (!authFailed) { | ||
_context.next = 14; | ||
break; | ||
} | ||
case 11: | ||
throw _context.sent; | ||
throw new Error('Authorization Error'); | ||
case 12: | ||
case 14: | ||
return _context.abrupt('return', responseText); | ||
case 15: | ||
throw responseText; | ||
case 16: | ||
case 'end': | ||
@@ -76,0 +88,0 @@ return _context.stop(); |
{ | ||
"name": "@highpoint/js-fetch", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "HighPoint Fetch Library", | ||
@@ -5,0 +5,0 @@ "main": "dist/js-fetch.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13468
229