axios-sugar
TypeScript icon, indicating that this package has built-in type declarations

2.0.1-0 • Public • Published

Travis (.org) Coveralls github version download license

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';

// suppose the request returns paramA
AxiosSugar.get('/somePath', {
  params: {
    paramA: 1
  }
}).then(res => {
  console.log(res.data); // 1
})

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.

Readme

Keywords

Package Sidebar

Install

npm i axios-sugar

Weekly Downloads

0

Version

2.0.1-0

License

MIT

Unpacked Size

767 kB

Total Files

89

Last publish

Collaborators

  • maoyonglong