biohttp: Normalized HTTP Transport with Circuit Breaking and Caching
Source:R/biohttp-package.R
biohttp-package.RdWeb service calls return a normalized result value instead of raising a condition, so a caller branches on data rather than on an error handler. Transport failure, a non-success status code, and an unreadable response body are reported as three distinct outcomes. Per-host circuit breaking, retry with a transient-failure predicate, optional throttling, redacted request headers, and a success-only cache come as defaults. Many questions to one source can be asked as a single batch, where only the entries the cache is missing reach the network. Service-specific knowledge is left to the client packages built on top. The circuit breaker is the pattern described in Nygard (2018, ISBN:9781680502398).
Details
Start at get_json(), post_json(), or get_text() for a call that
assembles, performs, and caches itself. Drop to perform() when you need to
build the request yourself, and pass it through req_defaults() first.
Every one of them returns an envelope() rather than raising, so a client
branches on res$status and writes no tryCatch() of its own.
Author
Maintainer: Samuel Bharti samuelbharti.io@gmail.com (ORCID) [copyright holder]
Authors:
Samuel Bharti samuelbharti.io@gmail.com (ORCID) [copyright holder]
Other contributors:
Barret Schloerke barret@posit.co (ORCID) [thesis advisor]
Carson Sievert carson@posit.co (ORCID) [thesis advisor]
Posit Software, PBC (ROR) [copyright holder, funder]