Compare commits

..

2 Commits

Author SHA1 Message Date
yutent f134e367b4 超时增加reson参数 2025-01-07 10:43:13 +08:00
yutent 763792d7f1 fixed undefined 2024-10-28 17:16:12 +08:00
3 changed files with 15 additions and 6 deletions

View File

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

View File

@ -84,13 +84,17 @@ export const Format = {
mkFormData(data) {
let form = new FormData()
for (let i in data) {
let el = data[i]
if (Array.isArray(el)) {
el.forEach(function (it) {
let val = data[i]
if (val === void 0) {
val = ''
}
if (Array.isArray(val)) {
val.forEach(function (it) {
form.append(i + '[]', it)
})
} else {
form.append(i, data[i])
form.append(i, val)
}
}
return form
@ -105,6 +109,11 @@ export const Format = {
if (/native code/.test(v)) {
return
}
if (v === void 0) {
v = ''
}
let _type = getType(v)
v = typeof v === 'function' ? v() : v

View File

@ -204,7 +204,7 @@ class _Request {
}
abort() {
this.control.abort()
this.control.abort(`Request timeout: ${~~(this.options.timeout / 1000)}s`)
}
__type__(type) {