多端通用的请求库,在axios的基础上,支持小程序的请求。
- base axios@0.19.0
- 支持浏览器,node,微信小程序,百度智能小程序
- api方法与axios一致
- 小程序暂不支持上传,下载功能
- 适合小程序各种框架,
wepy
,mpvue
,taro
Install multiple-axios.js using npm:
$ npm install multiple-axios
Performing a GET
request
const axios = require('axios');
// Make a request for a user with a given ID
axios.get('/user?ID=12345')
.then(function (response) {
// handle success
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.then(function () {
// always executed
});
browser | node | 微信 | 百度 | |
---|---|---|---|---|
upload | ✔ | ✔ | ✘ | ✘ |
download | ✔ | ✔ | ✘ | ✘ |
timeout | ✔ | ✔ | ✘ | ✘ |
dataType | ✘ | ✘ | ✔ | ✔ |
responseType | ✘ | ✘ | ✔ | ✔ |
withCredentials | ✔ | ✔ | ✘ | ✘ |
auth | ✔ | ✔ | ✘ | ✘ |
xsrfCookieName | ✔ | ✔ | ✘ | ✘ |
xsrfHeaderName | ✔ | ✔ | ✘ | ✘ |
onUploadProgress | ✔ | ✔ | ✘ | ✘ |
onDownloadProgress | ✔ | ✔ | ✘ | ✘ |
maxContentLength | ✔ | ✔ | ✘ | ✘ |
maxRedirects | ✔ | ✔ | ✘ | ✘ |
httpAgent | ✔ | ✔ | ✘ | ✘ |
httpsAgent | ✔ | ✔ | ✘ | ✘ |
proxy | ✔ | ✔ | ✘ | ✘ |
- 由于支付宝暂不支持请求本地服务,期待支持
- 快应用调研中
MIT