HTTP client transport for real-world and failure-tolerant communication in Go.
The following Golang adapters are designed to mix-in to the chain of
http.RoundTripper
s to add functionality such as:
FixedRetries
: on recoverable errors, clone the request and attempt to re-issue it again a fixed number of times.ReliableBody
: consume the entirehttp.Response.Body
into memory. If reading the body fails, the entirehttp.RoundTripper
fails.RateLimit
: allow only N requests per given interval T through, blocking others.
httpClient := &http.Client{}
httpClient.Transport = mediate.FixedRetries(3,
mediate.ReliableBody(http.DefaultTransport),
)