1.0.0 • Published 5 years ago
obtain-fetch v1.0.0
obtain-fetch
To construct a request lib.
To do list
interceptor
拦截器obtain.use
插件模式concurrency
并发数控制cache
接口缓存
...
Getting started
usage
// 暂未发布npm
import obtain from 'obtain-fetch'
// 默认get
obtain('http://localhost:4000/banner', {
method: 'POST',
body: {}
})
interceptor
obtain.use(http => {
// 请求拦截器
http.interceptor.request.use(
option => option,
err => {},
)
// 响应拦截器
http.interceptor.response.use(
res => res,
err => {},
)
})
concurrency
默认不控制
obtain.use(http => {
http.concurrency = 10
})
1.0.0
5 years ago