From 4d97503ee02d460b67a88b9bd01c923d303431a0 Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 17 Feb 2023 17:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96content-type=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.js | 2 +- src/next.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 {