Locales
简体中文
AxiosSugar
An wrapper for axios.js
Carefully
The new version has significant changes and is not compatible with the old version.
Compared with the old version, it is used in a very similar way to Axios.
Features
- Axios-Like Methods
- Cancel Repeated Requests
- Retry
- Response Storage
- Broken Network Retransmission
- Handlers for Http-Status-Code Responses
- Cancel All Requests Matched By Filter
Usage
import AxiosSugar from 'axios-sugar';
AxiosSugar.get('/somePath', {
params: {
paramA: 1
}
}).then(res => {
console.log(res.data);
})
Look, it's really like Axios!The request, get, post, delete, put, patch, head, options is also.
The difference is that these methods also receive an AxiosSugarConfig type parameter.
e.g.
AxiosSugar.get('/somePath', {
params: {
paramA: 1
}
}, {
retry: {
enable: true
}
})
Next, you should get more details in references
Test
Node test:
npm test
Some browser test(e.g. AxiosSugarLocalStorage)
:
open the corresponding index.html
File in /test
which built by mocha.