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

node-fetch-retry

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

node-fetch-retry - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0

8

index.js

@@ -1,3 +0,1 @@

const fetch = require('node-fetch');
module.exports = async (url, opts) => {

@@ -8,9 +6,9 @@ let retry = opts && opts.retry || 3

try {
return await fetch(url, opts)
return await import('node-fetch').then(({ default: fetch }) => fetch(url, opts))
} catch(e) {
if (opts && opts.callback) {
opts.callback(retry)
}
}
retry = retry - 1
if (retry == 0) {
if (retry === 0) {
throw e

@@ -17,0 +15,0 @@ }

{
"name": "node-fetch-retry",
"version": "1.1.2",
"version": "2.0.0",
"description": "Retry library for node-fetch",

@@ -27,7 +27,8 @@ "scripts": {

"mocha": "^9.0.3",
"should": "^13.2.3"
"should": "^13.2.3",
"timeout-signal": "^1.1.0"
},
"dependencies": {
"node-fetch": "^2.6.1"
"node-fetch": "^3.0.0"
}
}
require('should');
const assert = require('assert');
const timeoutSignal = require('timeout-signal');
const fetch = require('..');

@@ -11,3 +12,3 @@

retry: 3,
timeout: 2
signal: timeoutSignal(2),
}

@@ -28,3 +29,3 @@ try {

retry: 3,
timeout: 2,
signal: timeoutSignal(2),
callback: retry => {

@@ -31,0 +32,0 @@ calls.push(retry)

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