Skip to content

Commit

Permalink
Switch from using custom HTTP client caching to make-fetch-happen.
Browse files Browse the repository at this point in the history
This is a similar treatment as to what was applied to `@apollo/gateway` in
@trevor-sheer's #3783.

This replaces a local HTTP cache implementation which continues to grow in
complexity with an off-the-shelf Fetch API client with many valuable bells
and whistles.  In particular, it uses `make-fetch-happen`, which is a
relatively full-featured Node.js based implementation which is used by `npm`
itself and leverages `minipass-fetch` under the hood.

This leverages the same cache implementation used in `@apollo/gateway` and
duplicates that cache logic.   It's entirely possible we would be
well-served to use the `cache.js` example that's included in the source of
`make-fetch-happen` and leverages `cacache`, but as of this message, it
doesn't include the TypeScript types and this implementation seems to work.

Ref: https://npm.im/make-fetch-happen
Ref: https://npm.im/minipass-fetch
Ref: https://npm.im/cacache
Ref: https://github.com/npm/make-fetch-happen/blob/b04c4c16/cache.js
  • Loading branch information
abernix committed Jun 26, 2020
1 parent 0f9e170 commit 96b23bd
Show file tree
Hide file tree
Showing 6 changed files with 434 additions and 37 deletions.
Loading

0 comments on commit 96b23bd

Please sign in to comment.