resty
Replayability-safe typed HTTP client
goforge.dev/resty is the /goals/09-resty semantic rewrite of Resty. It is
authored in Go+ and distributed as ordinary generated Go.
The current release is v0.1.3, built against the released Go+ stdlib v0.207.0.
Semantics before fluent syntax
Request[method, replayability, decodePhase]retains the HTTP method and legal body transitions.- Byte bodies remain replayable; streaming readers become one-shot, making a retry attempt fail during Go+ checking rather than after a partial upload.
- Quantity-1 transitions consume request and response capabilities exactly once, with use-once runtime cells at ordinary-Go boundaries.
- Outcomes exhaustively distinguish success, HTTP failure, transport failure, cancellation, and decode failure.
- Response bodies must be decoded, discarded, or explicitly transferred to
the caller as an owned
io.ReadCloser.
Retry policy handles transport errors, HTTP 429, and HTTP 5xx responses. A superseded response is drained and closed before another attempt, exponential backoff is overflow-safe and capped, and cancellation interrupts a wait.
Measured gate
Five end-to-end benchmark runs against the same stub transport measured 325.7–330.0 ns and 13 allocations for the rewrite, versus 1141–1149 ns and 29 allocations for Resty v2.17.2. Using conservative endpoints, the rewrite is at least 3.45x faster with 55.2% fewer allocations. The allocation reduction is enforced continuously in the test suite.
Provenance
The upstream baseline is Resty v2.17.2 at commit
b1b3aaa32811319f8180a4b211995a2edf21e2ea, MIT licensed. The rewrite is
independently structured and retains the pinned upstream license alongside its
own MIT license.