@selkirk-systems/fetch 0.1.4 → 0.1.5

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 CHANGED
@@ -17,23 +17,13 @@ function _checkFetchStatus(response) {
17
17
  var error = new Error(response.statusText);
18
18
  return response.text().then(function (text) {
19
19
  if (text) {
20
- JSON.parse(text).json().then(function (result) {
21
- error.response = result;
22
- throw error;
23
- });
24
- } else {
25
- throw error;
20
+ error.response = JSON.parse(text);
26
21
  }
22
+ throw error;
27
23
  });
28
24
  }
29
25
  }
30
26
 
31
- function _parseJSON(response) {
32
- return response.text().then(function (text) {
33
- return text ? JSON.parse(text) : {};
34
- });
35
- }
36
-
37
27
  function _invokeFetch(url, props) {
38
28
  if (!url) {
39
29
  throw new Error("fetch:Missing Parameter - URL");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selkirk-systems/fetch",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A wrapper on fetch-polyfill that will work for server and client environments",
5
5
  "selkirk": {
6
6
  "bambooDeploy": "npm",
package/src/index.js CHANGED
@@ -15,23 +15,13 @@ function _checkFetchStatus(response) {
15
15
  var error = new Error(response.statusText);
16
16
  return response.text().then(function(text) {
17
17
  if (text) {
18
- JSON.parse(text).json().then((result)=>{
19
- error.response = result;
20
- throw error;
21
- });
22
- } else {
23
- throw error;
18
+ error.response = JSON.parse(text);
24
19
  }
20
+ throw error;
25
21
  });
26
22
  }
27
23
  }
28
24
 
29
- function _parseJSON(response) {
30
- return response.text().then(function(text) {
31
- return text ? JSON.parse(text) : {}
32
- });
33
- }
34
-
35
25
  function _invokeFetch(url,props) {
36
26
  if(!url) {
37
27
  throw new Error("fetch:Missing Parameter - URL");