New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

http-request-retry

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-request-retry

request can retry if fail

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

http-request-retry

http-request-retry

  • Config request can retry n time if has error.
  • It has small dependencies include lodash and request.

Install module

npm install http-request-retry --save

Step 1: import module

let httpService = require('http-request-retry');

Step 2: config module

httpService.config({
  debug: false, //log consle if error
  delay: 1000, //waiting time between each retry
});

Step 3: repair options

let options = {
  url: `url request`, // required; url request Ex: http://abc.com https://abc.com
  method: "GET", //required; default POST
  headers: {}, //optional Ex: { 'Content-Type': 'application/json; charset=UTF-8' }
  retry:3,    //optional; type NUMBER
  timeout: 5000, //optional; request timeout; default 60000
};

Step 4: excute

httpService.requestPromise(options).then(res=>{
  console.log(res);
}).catch(err=>{
  console.error(err);
})

Or

httpService.requestCallback(options,(err, result)=>{
  if(err){
    console.log(`Final err`, err);
  }
});

Keywords

FAQs

Package last updated on 03 Feb 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