Creates a fetch function that returns a lazy TaskEither instead of rejecting
for network, HTTP status, or response parsing failures.
Successful response bodies are parsed as JSON when the content type is JSON,
and as text otherwise. parse and parseLeft can replace these defaults.
The fetch implementation can also be supplied for environments without a
global Fetch API.
The returned function produces a lazy TaskEither; calling it with ()
performs the request. The resolved Either contains either the parsed body
or a typed network, status, or parser error, so it can be composed with
fp-ts mapping functions without a try ... catch around each request.
Creates a fetch function that returns a lazy
TaskEitherinstead of rejecting for network, HTTP status, or response parsing failures.Successful response bodies are parsed as JSON when the content type is JSON, and as text otherwise.
parseandparseLeftcan replace these defaults. The fetch implementation can also be supplied for environments without a global Fetch API. The returned function produces a lazyTaskEither; calling it with()performs the request. The resolvedEithercontains either the parsed body or a typed network, status, or parser error, so it can be composed withfp-tsmapping functions without atry ... catcharound each request.