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

simple-axios-interceptors

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-axios-interceptors

## Installation ```bash # With Yarn yarn add simple-axios-interceptors

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Simple Axios Interceptors

Installation

# With Yarn
yarn add simple-axios-interceptors

# With NPM
npm install simple-axios-interceptors

Usage

import axios from 'axios';
import connect from 'simple-axios-interceptor';

const instance = axios.create({
  baseURL: 'https://api.twitter.com/',
  timeout: 1000,
  headers: {'X-Custom-Header': 'foobar'}
});

connect(instance, 'twitter')
  .onRequest((label, { request }) => {
    ...
  })
  .onRequestError((label, { error }) => {
    ...
  })
  .onResponse((label, { response }) => {
    ...
  })
  .onResponseError((label, { error }) => {
    ...
  });

Parameters

connect(instance, label)

  • instance - Axios Instance
  • label - Default: null Instance Label

onRequest(callback)

  • callback - Passes in label and { error }

onRequestError(callback)

  • callback - Passes in label and { error }

onResponse(callback)

  • callback - Passes in label and { error }

onResponseError(callback)

  • callback - Passes in label and { error }

FAQs

Package last updated on 21 Jun 2019

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