1.2.5 • Published 1 month ago
yuumi-request v1.2.5
quick start
npm install yuumi-request --save
import YuumiRequest from 'yuumi-request'
new YuumiRequest({
baseURI: string
headers: Record<string, string>
concurrency: number
timeout: number
// 自定义params格式化函数
paramStringify?: (value: any) => string
// 自定义xhr函数
xhr?: <T>(option: XHR_RequestOption) => Promise<T>
})
request
new YuumiRequest().request({
path: string
method: RequestMethod
async?: boolean
headers?: { [key: string]: string }
params?: { [key: string]: number|string|(<number|string>[]) }
data?: any
timeout?: number
cancelToken?: (cancel?: () => void) => void
uploader?: { [key: string]: EventListener }
enforce? : "pre"|"normal"
})
get, post, delete, put
new YuumiRequest()['get'](path, params, {
async?: boolean
headers?: { [key: string]: string }
params?: { [key: string]: number|string|(<number|string>[]) }
data?: any
timeout?: number
cancelToken?: (cancel?: () => void) => void
uploader?: { [key: string]: EventListener }
enforce? : "pre"|"normal"
})
new YuumiRequest()['post'|'put'|'delete'](path, data, {
async?: boolean
headers?: { [key: string]: string }
params?: { [key: string]: number|string|(<number|string>[]) }
data?: any
timeout?: number
cancelToken?: (cancel?: () => void) => void
uploader?: { [key: string]: EventListener }
enforce? : "pre"|"normal"
})
interceptors
const request = new YuumiRequest()
request.interceptors.request((data: any) => Promise.resolve(data), (reason?: any) => Promise.reject(reason))
request.interceptors.request((data: any) => Promise.resolve(data), (reason?: any) => Promise.reject(reason))
1.2.5
1 month ago
1.2.4
1 month ago
1.2.3
2 months ago
1.2.2
2 months ago
1.2.1
2 months ago
1.2.0
2 months ago
1.1.1
2 months ago
1.1.0
2 months ago
1.0.6
2 months ago
1.1.0-beta
7 months ago
1.0.10
2 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.0
3 years ago
0.2.1
4 years ago
0.2.0
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago