z-go-http-client
Installation
SKILL.md
Go HTTP client hardening
Every outbound net/http call to another service needs a bound on time, a bound on connections, a closed body, and a retry policy that knows what it's retrying. None of this is optional hardening — a bare http.Client{} calling a flaky dependency is how one slow provider takes down the whole pod.
Quick reference
| Concern | Default | Reach for more when |
|---|---|---|
| Timeout | per-call deadline, Client.Timeout as a bounded-call backstop |
streaming needs first-byte, idle and maximum-lifetime budgets |
| Transport | clone http.DefaultTransport, raise MaxIdleConnsPerHost |
one dependency gets real QPS |
| Response body | close on every path | optionally drain a bounded remainder for connection reuse |
| Retry | idempotent methods, exponential backoff + jitter, bounded by ctx | POST needs a server-honored idempotency key first |
| Circuit breaker | skip it | one dependency, called from many paths, fails often enough that retries pile up load on it |
| Instrumentation | otelhttp.NewTransport wrapping the tuned transport |
always, once the service ships to production |