isomorphic-fetch-http
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -104,13 +104,13 @@ 'use strict'; | ||
key: 'get', | ||
value: function get(url, param) { | ||
var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
value: function get(url, param, cors) { | ||
var header = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this[http](url + '?' + (0, _qs.stringify)(param), {}, header); | ||
return this[http](url + '?' + (0, _qs.stringify)(param), cors ? { mode: "no-cors" } : {}, header); | ||
} | ||
}, { | ||
key: 'post', | ||
value: function post(url, param) { | ||
var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
value: function post(url, param, cors) { | ||
var header = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this[http](url, { method: 'POST', body: (0, _qs.stringify)(param) }, header); | ||
return this[http](url, _extends({ method: 'POST', body: (0, _qs.stringify)(param) }, cors ? { mode: "no-cors" } : {}), header); | ||
} | ||
@@ -117,0 +117,0 @@ }, { |
{ | ||
"name": "isomorphic-fetch-http", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "react fetch by isomorphic-fetch", | ||
@@ -5,0 +5,0 @@ "main": "lib/isomorphic-fetch-http.js", |
@@ -64,8 +64,8 @@ import fetch from 'isomorphic-fetch'; | ||
get(url, param, header = {}) { | ||
return this[http](`${url}?${stringify(param)}`, {}, header); | ||
get(url, param, cors, header = {}) { | ||
return this[http](`${url}?${stringify(param)}`, cors ? { mode: "no-cors" } : {}, header); | ||
} | ||
post(url, param, header = {}) { | ||
return this[http](url, {method: 'POST', body: stringify(param)}, header); | ||
post(url, param, cors, header = {}) { | ||
return this[http](url, {...{method: 'POST', body: stringify(param)}, ...cors ? { mode: "no-cors" } : {}}, header); | ||
} | ||
@@ -72,0 +72,0 @@ |
21405