Comparing version 0.0.5 to 0.0.6
@@ -47,3 +47,3 @@ 'use strict'; | ||
if (pathVarIndex !== -1) { | ||
params.push(key + '=' + value); | ||
params.push(key + '=' + encodeURIComponent(value)); | ||
} | ||
@@ -73,5 +73,7 @@ }); | ||
requestOptions.body = body; | ||
requestOptions.credentials = "omit"; | ||
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb)); | ||
requestOptions.mode = 'cors'; | ||
if (typeof window === 'undefined') | ||
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb)); | ||
else | ||
return window.fetch(uri, requestOptions, getParseJsonFn(cb)); | ||
} | ||
@@ -88,5 +90,11 @@ } else { | ||
requestOptions.method = method.toUpperCase(); | ||
requestOptions.credentials = "omit"; | ||
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb)); | ||
requestOptions.mode = 'cors'; | ||
if (typeof window === 'undefined') | ||
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb)); | ||
else | ||
return window.fetch(uri, requestOptions).then(function(response) { | ||
response.json().then(function(data) { | ||
cb(null, data, response) | ||
}) | ||
}); | ||
} | ||
@@ -98,2 +106,3 @@ } | ||
return function (error, message, body) { | ||
console.log('test', cb) | ||
var parsedBody; | ||
@@ -100,0 +109,0 @@ |
{ | ||
"name": "asksteem", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Wrapper for the AskSteem API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
5664
144