We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95a68f3 commit e624733Copy full SHA for e624733
src/index.js
@@ -203,7 +203,6 @@ export default (function create(/** @type {Options} */ defaults) {
203
}
204
205
const ok = options.validateStatus ? options.validateStatus(res.status) : res.ok;
206
- if (!ok) return Promise.reject(response);
207
208
if (options.responseType == 'stream') {
209
response.data = res.body;
@@ -217,7 +216,7 @@ export default (function create(/** @type {Options} */ defaults) {
217
216
response.data = JSON.parse(data);
218
})
219
.catch(Object)
220
- .then(() => response);
+ .then(() => (ok ? response : Promise.reject(response)));
221
});
222
223
0 commit comments