Comparing version 1.2.2 to 1.2.3-0
@@ -539,4 +539,9 @@ /** | ||
var headers = _extends({ | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json' | ||
}, defaultRequestOptions.headers); | ||
this.baseUrl = baseUrl; | ||
this.defaultRequestOptions = defaultRequestOptions; | ||
this.defaultRequestOptions = _extends({}, defaultRequestOptions, { headers: headers }); | ||
this.metaOptions = new MetaOptions(_extends({}, defaultMetaOptions, metaOptions)); | ||
@@ -594,3 +599,3 @@ this.log = this.metaOptions.logger; | ||
* @param {string} path the path of the request | ||
* @param {Object} options optional options, sepcific for this single request | ||
* @param {Object} options optional options, specific for this single request | ||
* @return {Object} res camelCased response | ||
@@ -636,8 +641,15 @@ */ | ||
}).then(function (res) { | ||
var status = res.status; | ||
var resultBase = { status: status, headers: res.headers, body: {} }; | ||
var contentLength = res.headers['map']['content-length']; | ||
var contentType = res.headers['map']['content-type']; | ||
if (contentLength <= 1 || contentType !== 'application/json') { | ||
return resultBase; | ||
} | ||
return res.json().then(function (json) { | ||
return { | ||
status: res.status, | ||
headers: res.headers, | ||
body: json | ||
}; | ||
return _extends({}, resultBase, { body: json }); | ||
}); | ||
@@ -644,0 +656,0 @@ }).then(function (parsedResponse) { |
@@ -541,4 +541,9 @@ 'use strict'; | ||
var headers = _extends({ | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json' | ||
}, defaultRequestOptions.headers); | ||
this.baseUrl = baseUrl; | ||
this.defaultRequestOptions = defaultRequestOptions; | ||
this.defaultRequestOptions = _extends({}, defaultRequestOptions, { headers: headers }); | ||
this.metaOptions = new MetaOptions(_extends({}, defaultMetaOptions, metaOptions)); | ||
@@ -596,3 +601,3 @@ this.log = this.metaOptions.logger; | ||
* @param {string} path the path of the request | ||
* @param {Object} options optional options, sepcific for this single request | ||
* @param {Object} options optional options, specific for this single request | ||
* @return {Object} res camelCased response | ||
@@ -638,8 +643,15 @@ */ | ||
}).then(function (res) { | ||
var status = res.status; | ||
var resultBase = { status: status, headers: res.headers, body: {} }; | ||
var contentLength = res.headers['map']['content-length']; | ||
var contentType = res.headers['map']['content-type']; | ||
if (contentLength <= 1 || contentType !== 'application/json') { | ||
return resultBase; | ||
} | ||
return res.json().then(function (json) { | ||
return { | ||
status: res.status, | ||
headers: res.headers, | ||
body: json | ||
}; | ||
return _extends({}, resultBase, { body: json }); | ||
}); | ||
@@ -646,0 +658,0 @@ }).then(function (parsedResponse) { |
{ | ||
"name": "snuffles", | ||
"version": "1.2.2", | ||
"version": "1.2.3-0", | ||
"description": "A wrapper around the native fetch function, returning the response body as a camelCased object", | ||
@@ -5,0 +5,0 @@ "author": "railslove", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168670
1223
2