当请求没有body时, 移除content-type, 保持与原生一致

master 2.1.3
yutent 2023-02-17 16:21:07 +08:00
parent 7983cb0b16
commit ea757efd31
3 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@bytedo/fetch", "name": "@bytedo/fetch",
"version": "2.1.2", "version": "2.1.3",
"description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch", "description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch",
"main": "dist/index.js", "main": "dist/index.js",
"files": [ "files": [

View File

@ -146,7 +146,10 @@ class _Request {
} }
} }
} }
} else {
delete options.headers['content-type']
} }
if (hasAttach) { if (hasAttach) {
delete options.headers['content-type'] delete options.headers['content-type']
} }

View File

@ -122,7 +122,10 @@ class _Request {
} }
break break
} }
} else {
delete options.headers['content-type']
} }
if (hasAttach) { if (hasAttach) {
delete options.headers['content-type'] delete options.headers['content-type']
} }