Skip to content

rhttp v0.1.0 — resilient HTTP client, zero dependencies

Choose a tag to compare

@oswaldom-code oswaldom-code released this 25 Jul 11:49
· 8 commits to main since this release
063b7d6

First public release of rhttp: a production-grade HTTP client for Go with built-in resiliency patterns and zero dependencies — Go standard library only.

Highlights

  • Middleware architecture — every capability is an http.RoundTripper decorator, composed with New(WithMiddleware(...)). Writing your own middleware is a one-liner with the exported RoundTripperFunc.
  • ResiliencyTimeout, Retry with pluggable backoff, CircuitBreaker (single-probe half-open, generation-gated state machine), and RateLimit (token bucket).
  • Retry-After aware — backoff strategies receive the response that triggered the retry; the WithRetryAfter decorator honors the Retry-After header (delay-seconds or HTTP-date) on 429/503.
  • Shared circuit stateNewCircuitBreaker lets several clients trip together against the same dependency, with observable State().
  • ObservabilityLogging and Metrics middleware; PathNormalizer bounds metrics label cardinality.
  • Fluent builderclient.R() with JSON/XML/form/reader bodies, path and query parameters. Bodies up to 10 MB are buffered so retries can rewind them; larger bodies stream and are sent exactly once.
  • Error classificationClassify, IsRetryable, IsTimeout, IsConnection and friends, plus the opinionated DecodeJSON helper.

Performance

Measured 2026-07-25 (linux/amd64, i7-1255U, min of 5 runs; see the README for methodology and caveats):

ns/op allocs/op
Full middleware stack (no-op transport) 1030 13
As a wrapper vs equivalently configured competitors 910 12
net/http floor (timeout only, no retry) 1750 26
Rate limiter check 48 0
Backoff strategies <10 0

Loopback numbers amplify relative differences — against a real network (0.5–500 ms) every client performs the same for practical purposes. Full tables and reproduction steps: benchmarks/REPORT.md.

Quality

  • 95.2% statement coverage on the root package; race-clean suite across Go 1.21–1.23 in CI.
  • Middleware interaction semantics (timeout budgets, per-attempt deadlines, breaker cutting retries) pinned by tests.

Install

go get github.com/oswaldom-code/rhttp@v0.1.0

Full changelog: CHANGELOG.md