附件判断增加Blob类型
parent
0735b4452d
commit
7983cb0b16
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@bytedo/fetch",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
|
|
|
@ -127,7 +127,10 @@ class _Request {
|
|||
params = options.body
|
||||
} else {
|
||||
for (let k in options.body) {
|
||||
if (toS.call(options.body[k]) === '[object File]') {
|
||||
if (
|
||||
toS.call(options.body[k]) === '[object File]' ||
|
||||
toS.call(options.body[k]) === '[object Blob]'
|
||||
) {
|
||||
hasAttach = true
|
||||
break
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ export const Format = {
|
|||
}
|
||||
|
||||
v = typeof v === 'function' ? v() : v
|
||||
v = toS.call(v) === '[object File]' ? v : encode(v)
|
||||
v = toS.call(v) === '[object File]' || toS.call(v) === '[object Blob]' ? v : encode(v)
|
||||
|
||||
arr.push(encode(k) + '=' + v)
|
||||
}
|
||||
|
|
|
@ -104,7 +104,10 @@ class _Request {
|
|||
}
|
||||
} else {
|
||||
for (let k in options.body) {
|
||||
if (toS.call(options.body[k]) === '[object File]') {
|
||||
if (
|
||||
toS.call(options.body[k]) === '[object File]' ||
|
||||
toS.call(options.body[k]) === '[object Blob]'
|
||||
) {
|
||||
hasAttach = true
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue