提交 8e55ca87 编写于 作者: d-u-a's avatar d-u-a

fix: 参数验证不支持二进制数据的bug,request data 为 Array报错的Bug

上级 87e3da93
...@@ -79,7 +79,9 @@ function assertType (value, type) { ...@@ -79,7 +79,9 @@ function assertType (value, type) {
valid = t === expectedType.toLowerCase() valid = t === expectedType.toLowerCase()
if (!valid && t === 'object') { if (!valid && t === 'object') {
valid = value instanceof type valid = value instanceof type
} }
} else if (value.byteLength >= 0) {
valid = true
} else if (expectedType === 'Object') { } else if (expectedType === 'Object') {
valid = isPlainObject(value) valid = isPlainObject(value)
} else if (expectedType === 'Array') { } else if (expectedType === 'Array') {
......
...@@ -59,7 +59,7 @@ export const request = { ...@@ -59,7 +59,7 @@ export const request = {
} }
}, },
data: { data: {
type: [Object, String, ArrayBuffer], type: [Object, String, Array, ArrayBuffer],
validator (value, params) { validator (value, params) {
params.data = value || '' params.data = value || ''
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册