A production-ready HTTP client for Go that doesn't make you cry.
Stop wrestling with http.DefaultClient and endless boilerplate. Get type-safe requests, automatic retries, circuit breakers, observability, and everything else you wish the standard library had—without the complexity.
// That's it. Seriously.
resp, err := httpx.GET[User](
httpx.WithBaseURL("https://api.example.com"),
httpx.WithPath("/users/123"),
)Built for production with retries, circuit breakers, rate limiting, caching, tracing, metrics, and middleware—all optional, all composable, none of the headache.
go get github.com/bdpiprava/easy-httppackage main
import (
"fmt"
"github.com/bdpiprava/easy-http/pkg/httpx"
)
type User struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
func main() {
// GET with automatic JSON unmarshaling
user, err := httpx.GET[User](
httpx.WithBaseURL("https://api.example.com"),
httpx.WithPath("/users/1"),
)
if err != nil {
panic(err)
}
fmt.Printf("Hello, %s!\n", user.Body.Name)
// POST with type safety
newUser := User{Name: "Alice", Email: "alice@example.com"}
resp, err := httpx.POST[User](
httpx.WithBaseURL("https://api.example.com"),
httpx.WithPath("/users"),
httpx.WithJSONBody(newUser),
)
fmt.Printf("Created user ID: %d\n", resp.Body.ID)
}Core Features:
- 🎯 Type-safe generic responses with automatic JSON unmarshaling
- 🔄 Fluent API with functional options (no builders, no bloat)
- 🛡️ Built-in retry logic and circuit breakers
- ⚡ Rate limiting and request throttling
- 🗄️ RFC 7234 compliant HTTP caching
- 📦 Automatic compression (gzip/deflate)
Observability:
- 📊 Prometheus metrics out of the box
- 🔍 OpenTelemetry distributed tracing
- 🍪 Smart cookie management
- 🔐 Built-in auth helpers and middleware support
No magic. No surprises. Just HTTP that works.
👉 Full documentation, guides, and examples
Made with ❤️ for the Go community
⭐ Star this repo • 📖 Documentation • 🐛 Report Issues • 💬 Discussions