3 ms·
Sounds like there's space for an axios-like library built on top of fetch.
by hiccuphippo 1y ago
Sounds like there's space for an axios-like library built on top of fetch.
- lllllllllllll6 1y ago[dead]
- farkin88 1y agoI think that's the sweet spot. Native fetch performance with axios-style conveniences. Some libraries are moving in that direction, but nothing's really nailed it yet. The challenge is probably keeping it lightweight while still solving the evaluating 5 retry packages problem.
- crabmusket 1y agoIs this what you're looking for? https://www.npmjs.com/package/ky https://www.npmjs.com/package/ky I haven't used it but the weekly download count seems robust.
- farkin88 1y agoKy is definitely one of the libraries moving in that direction. Good adoption based on those download numbers, but I think the ecosystem is still a bit fragmented. You've got ky, ofetch, wretch, etc. all solving similar problems. But yeah, ky is probably the strongest contender right now, in my opinion.
- hokkos 1y agoLike axios can do it if you specify the fetch backend, it just won't do the .json() asynchronously.
- tracker1 1y agoI'm actually not a big fan of the async .json from fetch, because when it fails (because "not json"), then you can't peak at the text instead. Of course, you can clone the response, apparently, and then read text from the clone... and if you're wrapping for some other handling, it isn't too bad.