Specializes fetch with some slightly different behavior and additional features:
- throws on ratelimit errors to mitigate unintentional abuse
- optional parse function called on the return value
- optional cache (different from the browser cache,
the caller can serialize it so e.g. dev setups can avoid hitting the network)
- optional simplified API for authorization and data types
(you can still provide headers directly)
Unlike fetch, this throws on ratelimits (status code 429)
to halt whatever is happpening in its tracks to avoid accidental abuse,
but returns a Result in all other cases.
Handling ratelimit headers with more sophistication gets tricky because behavior
differs across services.
(e.g. Mastodon returns an ISO string for x-ratelimit-reset,
but GitHub returns Date.now()/1000,
and other services may do whatever, or even use a different header)
It's also stateless to avoid the complexity and bugs,
so we don't try to track x-ratelimit-remaining per domain.
If the value is cached, only the cached safe subset of the headers are returned.
(currently just etag and last-modified)
Otherwise the full res.headers are included.