HTTP client plumbing: capped requests, typed status and rate-limit errors, Retry-After, redirect policies, and resumable verified file downloads. Package httpkit, module github.com/Rethunk-Tech/go-httpkit.
A program that talks to several sites and downloads large files needs the same few things every time, and each is
easy to get subtly wrong: a body read with no size bound, a Retry-After that overflows, an API key that follows a
redirect to another host, a download that restarts from zero after a dropped connection. This module is the one
correct copy of each.
go get github.com/Rethunk-Tech/go-httpkitA worked example and the contracts: HUMANS.md.
DoCappedreads an answer at most N bytes and turns every other status into a*StatusErrorthaterrors.Ismatches againstErrNotFoundandErrRateLimited.RetryAfterreads both header forms and refuses values that would overflow aDuration.NoDowngrade,SameOriginandNoFollowkeep credentials where they belong;WithRedirectadds one to a client without losing the client's own.Transportsets a default User-Agent and reports every round trip.download.Fileresumes, verifies and size-limits a download, fails a stalled body withErrIdle, and shares one bandwidthLimiteracross downloads.download.RangeReaderreads a remote file's parts through ranged GETs.
| Doc | Audience |
|---|---|
| HUMANS.md | Running and using the package |
| AGENTS.md | Internals, invariants, and why |
| CONTRIBUTING.md | Process — commits, tests, docs |
| SECURITY.md | Vulnerability disclosure |
| CHANGELOG.md | Release notes |
MIT — see LICENSE. © 2026 Rethunk.Tech, LLC.