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

make-fetch-happen

Package Overview
Dependencies
Maintainers
6
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-fetch-happen

Opinionated, caching, retrying fetch client

  • 10.1.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19M
increased by6.83%
Maintainers
6
Weekly downloads
 
Created

What is make-fetch-happen?

The make-fetch-happen npm package is a wrapper around the node-fetch package which provides additional features such as caching, retries, proxy support, and more. It is designed to make HTTP requests in Node.js environments more robust and feature-rich.

What are make-fetch-happen's main functionalities?

Caching

This feature allows make-fetch-happen to cache responses locally, which can be reused for future requests to the same resource, saving bandwidth and time.

const fetch = require('make-fetch-happen').defaults({
  cacheManager: './my-cache' // path where cache will be stored
});

fetch('https://example.com').then(response => response.json()).then(data => console.log(data));

Retries

This feature enables automatic retries of failed requests, with customizable settings for the number of retries, delay strategy, and more.

const fetch = require('make-fetch-happen').defaults({
  retry: {
    retries: 3, // maximum amount of retries
    factor: 2, // the exponential factor for delay between retries
    minTimeout: 1000 // the number of milliseconds before starting the first retry
  }
});

fetch('https://example.com').then(response => response.json()).then(data => console.log(data));

Proxy Support

This feature allows requests to be made through a specified HTTP or HTTPS proxy.

const fetch = require('make-fetch-happen').defaults({
  proxy: 'http://myproxy.com:8080'
});

fetch('https://example.com').then(response => response.json()).then(data => console.log(data));

Timeouts

This feature allows setting a maximum time to wait for a response before aborting the request.

const fetch = require('make-fetch-happen').defaults({
  timeout: 5000 // time in milliseconds
});

fetch('https://example.com').then(response => response.json()).then(data => console.log(data));

Other packages similar to make-fetch-happen

Keywords

FAQs

Package last updated on 02 Jun 2022

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