New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

http-resilient-executor

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

http-resilient-executor

NodeJS http resilient executor

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

http-resilient-executor

Helper for creating retry policies , circuit breaker for functions and external requests

Config

NameDescription
httpResilienceCBHalfOpenAfterMSIndicates the Time CircuitBreaker to be in half open state
httpResilienceRetryCountRetry count for requests
httpResilienceCBConsecutiveThresholdMaximum attempts to open CircuitBreaker

For logger configuration properties see the logger documentation

Usage

// init ResilientExecutor instance (should use 1 instance per app)
import { ResilientExecutor } from 'http-resilient-executor';

const config = {
  /** logger configuration */
  logger: { logLevel: 'cli', logStyle: 'debug', appName: 'nodejs-commons',moduleName: 'ResilientExecutor' },

  /** After 10 seconds the CB will be half open state */
  httpResilienceCBHalfOpenAfterMS: 10 * 1000,

  /** After 5 consecutive failed requests, the CB will be open */
  httpResilienceCBConsecutiveThreshold: 5,

  /**  Retry count for failed requests */
  httpResilienceRetryCount: 3,
};

const resilientExec = new ResilientExecutor(config);

/** use resilientExecutor to wrap functions and api calls */
/** to wrap function */
await resilientExec.execute(testMock);

/** to wrap api */

await this.executor.execute(() =>
        axios.post(this.authUrl, params,
        {
          headers: { 'Content-Type': 'application/x-www-form-urlencoded'},
          auth: credentials,
        }),
      );

Keywords

axios

FAQs

Package last updated on 21 Feb 2024

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