diff --git a/src/index.js b/src/index.js index ad88a26..d84d887 100644 --- a/src/index.js +++ b/src/index.js @@ -135,6 +135,7 @@ class FetchMock { obj = { status: 200, data: obj, + ok: true }; } diff --git a/src/response.js b/src/response.js index 85123b1..cc5e8fc 100644 --- a/src/response.js +++ b/src/response.js @@ -22,6 +22,14 @@ class Response { return this[_statusText]; } + get ok() { + if (this[_status] >= 200 && this[_status] < 300) { + return true; + } else { + return false; + } + } + text() { try { return Promise.resolve(JSON.stringify(this[_data]));