Using fetch
Using fetch? Consider Ky.
Benefits:
- Simpler API - Requires about half the code
- Treats non-2xx status codes as errors
- Includes timeout support
- Retries failed requests
- Better TS support. json() resolves to unknown
Here's fetch vs Ky - literally half the code. 🔥

"What about Axios?"
Axios is based on XmlHttpRequest. It's 11.7KB gzipped.
Ky is based on fetch. It's 3.3KB gzipped.
Ky's bundle size is smaller because fetch is a lighter, more modern foundation. Ky's API is simpler than Axios too.
Three other fetch alternatives mentioned in the thread:
Wretch: https://github.com/elbywan/wretch
Better Fetch: https://better-fetch.vercel.app/docs
ofetch: https://github.com/unjs/ofetch