Skip to content
A decorator on top of `fetch` that caches the DNS query
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore implement it Oct 19, 2017
History.md
LICENSE
README.md Add res object to onRetry (#6) Mar 28, 2018
index.d.ts Add Typescript types (#13) Apr 23, 2019
index.js Bump @zeit/dns-cached-resolve Feb 4, 2019
package.json
test.js Add res object to onRetry (#6) Mar 28, 2018
yarn.lock Bump eslint, jest, and prettier Jun 4, 2019

README.md

fetch-cached-dns

A decorator on top of fetch that caches the DNS query of the hostname of the passed URL.

How to use

const fetch = require('fetch-cached-dns')(require('node-fetch'))

Since this implementation is implementing redirects we are providing an onRedirect extra option to the fetch call that gets called with the response object and the options that will be used for the next request. This allows to access the request from outside and to modify the options.

NOTE: if the fetch implementation is not supplied, it will attempt to use peerDep node-fetch

You can’t perform that action at this time.