diff --git a/index.js b/index.js index a1ba973..5950b2d 100644 --- a/index.js +++ b/index.js @@ -26,11 +26,14 @@ } if (data) { - opts.body = JSON.stringify(data); + opts.body = data; } else { delete opts.body; } + if (data && opts.headers['Content-Type'] == 'application/json') + opts.body = JSON.stringify(data); + return fetchival.fetch(url, opts) .then(function (response) { if (response.status >= 200 && response.status < 300) {