Skip to content

Commit 207cd6e

Browse files
committed
Support response.ok
1 parent 0cccef7 commit 207cd6e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-fetch-mock",
3-
"version": "0.6.2",
3+
"version": "0.7.0",
44
"description": "fetch mock for reactjs",
55
"main": "index.js",
66
"scripts": {

src/response.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ class Response {
2222
return this[_statusText];
2323
}
2424

25+
get ok() {
26+
if (this.status >= 200 && this.status < 300) {
27+
return true;
28+
} else {
29+
return false;
30+
}
31+
}
32+
2533
text() {
2634
try {
2735
return Promise.resolve(JSON.stringify(this[_data]));

0 commit comments

Comments
 (0)