🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

axios-sugar

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-sugar

A wrapper for axios

2.0.1-0
latest
Source
npm
Version published
Maintainers
1
Created
Source

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.

Keywords

axios

FAQs

Package last updated on 31 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts