syncano-server
Advanced tools
Comparing version 0.7.2-11 to 0.7.2-12
@@ -33,3 +33,3 @@ 'use strict'; | ||
value: function fetch(url, options) { | ||
var request = (0, _nodeFetch2.default)(url, _extends({ | ||
return (0, _nodeFetch2.default)(url, _extends({ | ||
headers: { | ||
@@ -40,4 +40,2 @@ 'Content-Type': 'application/json', | ||
}, options)).then(_utils.checkStatus).then(_utils.parseJSON); | ||
return request; | ||
} | ||
@@ -47,3 +45,3 @@ }, { | ||
value: function nonInstanceFetch(url, options, headers) { | ||
var request = (0, _nodeFetch2.default)(url, _extends({ | ||
return (0, _nodeFetch2.default)(url, _extends({ | ||
headers: _extends({ | ||
@@ -53,4 +51,2 @@ 'Content-Type': 'application/json' | ||
}, options)).then(_utils.checkStatus).then(_utils.parseJSON); | ||
return request; | ||
} | ||
@@ -57,0 +53,0 @@ }, { |
@@ -26,7 +26,6 @@ 'use strict'; | ||
function parseJSON(response) { | ||
try { | ||
return response.json(); | ||
} catch (err) { | ||
return response.text(); | ||
if (response.status === 202) { | ||
return Promise.resolve(); | ||
} | ||
return response.json(); | ||
} | ||
@@ -33,0 +32,0 @@ |
{ | ||
"name": "syncano-server", | ||
"version": "0.7.2-11", | ||
"version": "0.7.2-12", | ||
"description": "A library to intereact with the Syncano API on a server side", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -11,3 +11,3 @@ import nodeFetch from 'node-fetch' | ||
fetch(url, options) { | ||
const request = nodeFetch(url, { | ||
return nodeFetch(url, { | ||
headers: { | ||
@@ -21,8 +21,6 @@ 'Content-Type': 'application/json', | ||
.then(parseJSON) | ||
return request | ||
} | ||
nonInstanceFetch(url, options, headers) { | ||
const request = nodeFetch(url, { | ||
return nodeFetch(url, { | ||
headers: { | ||
@@ -36,4 +34,2 @@ 'Content-Type': 'application/json', | ||
.then(parseJSON) | ||
return request | ||
} | ||
@@ -40,0 +36,0 @@ |
@@ -16,7 +16,6 @@ import {getHost, SYNCANO_API_VERSION} from './settings' | ||
export function parseJSON(response) { | ||
try { | ||
return response.json() | ||
} catch (err) { | ||
return response.text() | ||
if (response.status === 202) { | ||
return Promise.resolve() | ||
} | ||
return response.json() | ||
} | ||
@@ -23,0 +22,0 @@ |
Sorry, the diff of this file is not supported yet
447340
1617