diff --git a/src/index.js b/src/index.js index 27b4433..28442bf 100644 --- a/src/index.js +++ b/src/index.js @@ -203,7 +203,6 @@ export default (function create(/** @type {Options} */ defaults) { } const ok = options.validateStatus ? options.validateStatus(res.status) : res.ok; - if (!ok) return Promise.reject(response); if (options.responseType == 'stream') { response.data = res.body; @@ -217,7 +216,7 @@ export default (function create(/** @type {Options} */ defaults) { response.data = JSON.parse(data); }) .catch(Object) - .then(() => response); + .then(() => (ok ? response : Promise.reject(response))); }); }