From d8070643c051d4917c6f5a9c29991ec1ab11faec Mon Sep 17 00:00:00 2001 From: Alexander Pushkov Date: Fri, 16 Sep 2022 05:32:07 +0300 Subject: [PATCH] Wrap rejected response, to stay in line with Axios API --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index cca6534..2d7aee2 100644 --- a/src/index.js +++ b/src/index.js @@ -219,7 +219,7 @@ function create(defaults) { .catch(Object) .then(() => { const ok = options.validateStatus ? options.validateStatus(res.status) : res.ok; - return ok ? response : Promise.reject(response); + return ok ? response : Promise.reject({ response }); }); }); }