From ea757efd3133d58f69fbe16ba976e134ae83cd47 Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 17 Feb 2023 16:21:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E8=AF=B7=E6=B1=82=E6=B2=A1=E6=9C=89bo?= =?UTF-8?q?dy=E6=97=B6,=20=E7=A7=BB=E9=99=A4content-type,=20=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E4=B8=8E=E5=8E=9F=E7=94=9F=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.js | 3 +++ src/next.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1e61b59..ffc1030 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bytedo/fetch", - "version": "2.1.2", + "version": "2.1.3", "description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch", "main": "dist/index.js", "files": [ diff --git a/src/index.js b/src/index.js index b5456b2..5d59ca6 100644 --- a/src/index.js +++ b/src/index.js @@ -146,7 +146,10 @@ class _Request { } } } + } else { + delete options.headers['content-type'] } + if (hasAttach) { delete options.headers['content-type'] } diff --git a/src/next.js b/src/next.js index 49ce53d..f7a4bfa 100644 --- a/src/next.js +++ b/src/next.js @@ -122,7 +122,10 @@ class _Request { } break } + } else { + delete options.headers['content-type'] } + if (hasAttach) { delete options.headers['content-type'] }