~/labs/reqx
reqx
A clean, extensible HTTP client with request builders, retries, OAuth support and sensible defaults.
A fluent, builder-pattern HTTP client for Go with a built-in retry mechanism, OAuth1 support and multipart form handling. It uses the standard library only.
Install
go get github.com/oshturhq/reqxFeatures
- Fluent builder pattern: chain methods for clean, readable code
- Basic Auth, Bearer Token and OAuth1 (HMAC-SHA1)
- Automatic retry with backoff for timeouts and 5xx errors
- JSON, form URL encoded and multipart form bodies
- Multipart form builder with streaming file uploads
- Context on the client, on a single request, or both
- Response helpers for status checks and JSON unmarshaling
- Zero dependencies: standard library only
Example
client, err := reqx.NewClientBuilder().
BaseURL("https://api.example.com").
Timeout(30 * time.Second).
BearerAuth("your-token").
Build()
if err != nil {
panic(err)
}
var result map[string]any
var errResp map[string]any
resp, err := client.Get("/users").
QueryParam("page", "1").
Do(&result, &errResp)