Comparing version 1.0.11 to 1.0.12
{ | ||
"name": "autofetch", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "fetch for node", | ||
@@ -5,0 +5,0 @@ "main": "src/index.node.js", |
@@ -8,5 +8,5 @@ const realFetch = require('isomorphic-fetch/fetch-npm-browserify.js'); | ||
const fetchRequest = (url, options = {}, ...extras) => { | ||
options.data ? options.method === 'GET' ? options.query = {...(options.query || {}), ...options.data} : options.body = {...(options.body || {}), ...options.data} : ''; | ||
options.data ? options.method === 'GET' ? options.query = { ...(options.query || {}), ...options.data } : options.body = { ...(options.body || {}), ...options.data } : ''; | ||
if(!options.method || options.method === 'GET'){ | ||
if (!options.method || options.method === 'GET') { | ||
options.body = options.body || options.data; | ||
@@ -16,3 +16,3 @@ } | ||
options.headers = options.headers || {}; | ||
if(options.headers['Content-Type'] !== 'application/json' && !(options.body instanceof 'FormData') { | ||
if (options.headers['Content-Type'] !== 'application/json' && !(options.body instanceof 'FormData')) { | ||
// convert to FormData | ||
@@ -19,0 +19,0 @@ options.body = toFormData(body); |
@@ -10,5 +10,5 @@ "use strict"; | ||
const fetchRequest = (url, options = {}, ...extras) => { | ||
options.data ? options.method === 'GET' ? options.query = {...(options.query || {}), ...options.data} : options.body = {...(options.body || {}), ...options.data} : ''; | ||
options.data ? options.method === 'GET' ? options.query = { ...(options.query || {}), ...options.data } : options.body = { ...(options.body || {}), ...options.data } : ''; | ||
if(!options.method || options.method === 'GET'){ | ||
if (!options.method || options.method === 'GET') { | ||
options.body = options.body || options.data; | ||
@@ -18,3 +18,3 @@ } | ||
options.headers = options.headers || {}; | ||
if(options.headers['Content-Type'] !== 'application/json' && !(options.body instanceof 'FormData') { | ||
if (options.headers['Content-Type'] !== 'application/json' && !(options.body instanceof 'FormData')) { | ||
// convert to FormData | ||
@@ -24,3 +24,3 @@ options.body = toFormData(body); | ||
return realFetch.call(this, parseUrl(url, options,baseHost), options, ...extras).then(responseMiddleware).then(globalCallback); | ||
return realFetch.call(this, parseUrl(url, options, baseHost), options, ...extras).then(responseMiddleware).then(globalCallback); | ||
}; | ||
@@ -27,0 +27,0 @@ |
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
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
14715
7