JSPM

@vercel/fetch-cached-dns

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 245441
  • Score
    100M100P100Q204520F
  • License MIT

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

Package Exports

  • @vercel/fetch-cached-dns

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vercel/fetch-cached-dns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fetch-cached-dns

Build Status

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

How to use

const fetch = require('@vercel/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