Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axios-cancelable

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-cancelable

Utility for cancellation of requests when using axios

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
44
decreased by-4.35%
Maintainers
1
Weekly downloads
 
Created
Source

axios-cancelable

package version package downloads standard-readme compliant package license make a pull request

Utility for cancellation of requests when using axios

Table of Contents

About

Personalized and actively maintained fork of axios-cancel

Install

This project uses node and npm.

$ npm install axios-cancelable
$ # OR
$ yarn add axios-cancelable

Usage

import axios from 'axios';
import axiosCancel from 'axios-cancelable';

axiosCancel(axios, {
  debug: false // default
});

...

// Single request cancellation
const requestId = 'my_sample_request';
const promise = axios.get(url, {
  requestId: requestId
})
  .then((res) => {
    console.log('resolved');
  }).catch((thrown) => {
    if (axios.isCancel(thrown)) {
      console.log('request cancelled');
    } else {
      console.log('some other reason');
    }
  });

axios.cancel(requestId);
// aborts the HTTP request and logs `request cancelled`

Contribute

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am "Add some feature"
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

MIT

FAQs

Package last updated on 24 Dec 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc