@selkirk-systems/fetch 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -10
- package/package.json +1 -1
- package/src/index.js +11 -11
package/dist/index.js
CHANGED
|
@@ -10,22 +10,22 @@ var _networkTimer = null;
|
|
|
10
10
|
|
|
11
11
|
function _checkFetchStatus(response) {
|
|
12
12
|
if (response.status >= 200 && response.status < 300) {
|
|
13
|
-
|
|
14
|
-
return response.json();
|
|
15
|
-
}
|
|
13
|
+
return response.json();
|
|
16
14
|
} else {
|
|
17
15
|
var error = new Error(response.statusText);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
error.response = result;
|
|
21
|
-
throw error;
|
|
22
|
-
});
|
|
23
|
-
} else {
|
|
16
|
+
return response.json().then(function (result) {
|
|
17
|
+
error.response = result;
|
|
24
18
|
throw error;
|
|
25
|
-
}
|
|
19
|
+
});
|
|
26
20
|
}
|
|
27
21
|
}
|
|
28
22
|
|
|
23
|
+
function _parseJSON(response) {
|
|
24
|
+
return response.text().then(function (text) {
|
|
25
|
+
return text ? JSON.parse(text) : {};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
29
|
function _invokeFetch(url, props) {
|
|
30
30
|
if (!url) {
|
|
31
31
|
throw new Error("fetch:Missing Parameter - URL");
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -8,22 +8,22 @@ const _networkTimer = null;
|
|
|
8
8
|
|
|
9
9
|
function _checkFetchStatus(response) {
|
|
10
10
|
if (response.status >= 200 && response.status < 300) {
|
|
11
|
-
|
|
12
|
-
return response.json()
|
|
13
|
-
}
|
|
11
|
+
return response.json()
|
|
14
12
|
} else {
|
|
15
13
|
var error = new Error(response.statusText);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
} else {
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
14
|
+
return response.json().then((result)=>{
|
|
15
|
+
error.response = result;
|
|
16
|
+
throw error;
|
|
17
|
+
});
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
20
|
|
|
21
|
+
function _parseJSON(response) {
|
|
22
|
+
return response.text().then(function(text) {
|
|
23
|
+
return text ? JSON.parse(text) : {}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
27
|
function _invokeFetch(url,props) {
|
|
28
28
|
if(!url) {
|
|
29
29
|
throw new Error("fetch:Missing Parameter - URL");
|