js-ipfs-utils icon indicating copy to clipboard operation
js-ipfs-utils copied to clipboard

fetch and http requests

Open achingbrain opened this issue 3 years ago • 5 comments

This module exposes a HTTP class that lets you make HTTP requests. It accepts and returns interfaces from the browser fetch spec. Internally it juggles multiple fetch implementations between browsers, node, electron, and react native.

The types of all of these implementations differ to the degree that they are largely incompatible which means we @ts-ignore a bunch of stuff which lets us move on but gives us no type safety and causes all sorts of weird bugs and code gymnastics in other parts of the codebase.

We don't use or need the entirety of the fetch specification. Instead lets stop trying to be a general-purpose polymorphic fetch implementation and instead just expose the bits of the fetch API we use and have each implementation just service those bits.

achingbrain avatar Nov 18 '21 09:11 achingbrain