From 532f54db54807d06db8cad004334241627426ff5 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Mon, 13 Jul 2015 05:36:36 +0430 Subject: [PATCH] If the response is not "ok", reject fetch --- lib/functions/fetch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/functions/fetch.js b/lib/functions/fetch.js index e88461f..461bb2b 100644 --- a/lib/functions/fetch.js +++ b/lib/functions/fetch.js @@ -15,7 +15,8 @@ export default function fetch(path, data = {}) { .field(data) .attach(files) .end(response => { - if (response.statusType === 4 || response.statusType === 5) { + if (response.statusType === 4 || response.statusType === 5 || + !response.body.ok) { reject(response); } else { resolve(response.body);