diff --git a/package.json b/package.json index ffc1030..c70d33c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bytedo/fetch", - "version": "2.1.3", + "version": "2.1.5", "description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch", "main": "dist/index.js", "files": [ diff --git a/src/index.js b/src/index.js index 5d59ca6..bb24e2b 100644 --- a/src/index.js +++ b/src/index.js @@ -182,7 +182,7 @@ class _Request { options.url += (~options.url.indexOf('?') ? '&' : '?') + '_t_=' + Date.now() } } else { - if (!hasAttach) { + if (options.body && !hasAttach) { if (~options.headers['content-type'].indexOf('json')) { params = JSON.stringify(params) } else { diff --git a/src/next.js b/src/next.js index f7a4bfa..2d89735 100644 --- a/src/next.js +++ b/src/next.js @@ -142,7 +142,7 @@ class _Request { } delete options.body } else { - if (!hasAttach) { + if (options.body && !hasAttach) { if (~options.headers['content-type'].indexOf('json')) { options.body = JSON.stringify(options.body) } else {