Skip to content

Releases

httpclient v0.3.0

Choose a tag to compare

@cmilesio cmilesio released this 03 Dec 09:06
4a7104a

Use generic methods directly on your configured client. client.Get[Order](ctx, path) decodes an order into a Go type. For writes, client.Post[Order](ctx, path, input) takes the response type and accepts the body as a value.

go get github.com/goforj/httpclient@v0.3.0

Requires Go 1.27 or newer.

What's better

  • The GitHub API quick start takes you from installation to a decoded response.
  • A runnable retry example shows a 503 followed by a successful response in two attempts using the recording transport.
  • The README explains typed HTTP errors, streaming responses, and what request dumps contain. The examples report errors and show the output to expect.

Upgrading

The seven package-level HTTP verb functions are removed. Replace httpclient.Get[Order](ctx, client, path) with client.Get[Order](ctx, path). For Post, Put, and Patch, specify the response type and pass the body as a value. Use httpclient.Default() when you need the shared client.

Migration guide · Full changelog

httpclient v0.2.0

Choose a tag to compare

@cmilesio cmilesio released this 03 Dec 06:03
89e6245

Every request now takes the caller's context as its first argument. Replace client.GetCtx[Order](ctx, path) with client.Get[Order](ctx, path) and add a context to calls that previously used one implicitly.

  • Retry delays honor cancellation. Eligible 429 and 503 replies can extend the delay with Retry-After, within the caller's deadline.
  • Client.Send returns the HTTP status, headers, and a streaming body.
  • httpclienttest.Transport serves response sequences and records requests without a running server.

Requires Go 1.27. See the documentation and migration guide.

HTTPClient v0.1.0

Choose a tag to compare

@cmilesio cmilesio released this 03 Dec 04:44
8098830

HTTPClient continues the Httpx v2 API at github.com/goforj/httpclient. Send typed HTTP requests, decode responses into Go values, and configure authentication and retries.

go get github.com/goforj/httpclient

HTTPClient requires Go 1.27 or newer. This release also closes request dump files as it writes them, so callers can remove the output after a request.

The existing Httpx module paths and versions remain available at goforj/httpx. See Migrate from Httpx to update a v2 consumer.

HTTPClient v2.1.3

Choose a tag to compare

@cmilesio cmilesio released this 01 Dec 21:28
657861c

Updates klauspost/compress to v1.20.5 for HTTP response decompression fixes, including fixes for malformed compressed data and short writes. Requires Go 1.27 or newer.

go get github.com/goforj/httpx/v2@v2.1.3

This snapshot preserves the original Httpx history. For the installable HTTPClient module, see HTTPClient v0.1.0.

HTTPClient v2.1.2

Choose a tag to compare

@cmilesio cmilesio released this 30 Nov 00:33
2a07ebd

Updates Brotli to v1.2.7 to fix GO-2026-6888 in HTTP response decompression. Also refreshes the README artwork.

Requires Go 1.27 or newer.

go get github.com/goforj/httpx/v2@v2.1.2

This snapshot preserves the original Httpx history. For the installable HTTPClient module, see HTTPClient v0.1.0.

HTTPClient v2.1.1

Choose a tag to compare

@cmilesio cmilesio released this 02 Nov 01:11
4a56384

Updates godump to v1.10.0 and klauspost/compress to v1.20.3.

Requires Go 1.27 or newer, unchanged from v2.1.0. Projects on older Go versions can keep v2.0.1. No HTTPX API changes.

go get github.com/goforj/httpx/v2@v2.1.1

This snapshot preserves the original Httpx history. For the installable HTTPClient module, see HTTPClient v0.1.0.

HTTPClient v2.1.0

Choose a tag to compare

@cmilesio cmilesio released this 17 Oct 14:51
43fad7d

HTTPX v2.1.0 adds generic client methods, fixes decoding for named raw response types, and updates HTTP compression and network security dependencies.

Generic client methods

Call typed request helpers directly on a client. Existing package functions remain available.

client := httpx.New()
user, err := client.Get[User]("https://api.example.com/users/1")

The method helpers cover all supported HTTP verbs, including their context variants. See #10.

Fixes

  • Named strings and byte slices now decode without panicking through package helpers, client methods, and Do. Thanks to @bensynapse for #16.
  • Updated klauspost/compress to v1.20.2 and golang.org/x/net to v0.61.0, along with crypto, sys, and text updates. See #20.
  • Updated the underlying req/v3 client to v3.61.0 and included the dependency security updates from #11.

Go version

Requires Go 1.27 or newer, increased from Go 1.24.4 in v2.0.1 to support generic client methods. Upgrade your local and CI toolchains before updating. Consumers remaining on older Go versions should stay on v2.0.1.

Upgrade

go get github.com/goforj/httpx/v2@v2.1.0

Full changes: goforj/httpx@v2.0.1...v2.1.0

This snapshot preserves the original Httpx history. For the installable HTTPClient module, see HTTPClient v0.1.0.

HTTPClient v2.0.0

Choose a tag to compare

@cmilesio cmilesio released this 29 Dec 07:32

Breaking Changes

  • Removes implicit error fields. Functions now return (T, error) so errors must be handled directly.
  • Request helpers now return the decoded value instead of a wrapper type, keeping usage simple and closer to typical Go APIs.
  • All request helpers (Get, Post, Put, etc.) use the same function signature.
  • Several legacy abstractions were removed, making the client easier to understand and maintain.
  • Errors work naturally with errors.Is, requests respect context cancellation, and middleware/logging integrate cleanly.
  • Simplifies the internal design and provides a cleaner base for future features.

API Changes Before/After

Before (v1 - implicit errors, wrapped result)

type User struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

res := httpx.Get[User](client, "https://api.example.com/users/1")

if res.Err != nil {
	log.Fatal(res.Err)
}

fmt.Println(res.Body.Name)

Problems

  • Error is hidden inside a wrapper
  • Easy to forget to check res.Err
  • Forces consumers to learn a custom response type

After (v2 - explicit, idiomatic Go)

type User struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

user, err := httpx.Get[User](client, "https://api.example.com/users/1")
if err != nil {
	log.Fatal(err)
}

fmt.Println(user.Name)

Improvements

  • Errors are explicit and unavoidable
  • Return values match standard Go expectations
  • Cleaner, more readable call sites

Before (v1 - POST with response wrapper)

res := httpx.Post[CreateUser, User](client, "/users", CreateUser{Name: "Ana"})
if res.Err != nil {
	log.Fatal(res.Err)
}
fmt.Println(res.Body)

After (v2 - explicit input/output)

user, err := httpx.Post[CreateUser, User](client, "/users", CreateUser{Name: "Ana"})
if err != nil {
	log.Fatal(err)
}
fmt.Println(user)

Before (v1 - response wrapper access)

res := httpx.Get[User](client, "/users/1")
status := res.Response.StatusCode

After (v2 - explicit access via Do)

req := httpx.NewRequest("GET", "/users/1")
user, resp, err := httpx.Do[User](req)
if err != nil {
	log.Fatal(err)
}
fmt.Println(resp.StatusCode)

Summary

  • No hidden error fields
  • No wrapper structs
  • Explicit, idiomatic Go APIs
  • Easier to reason about and compose

This change makes the library safer, simpler, and more predictable without sacrificing power.

This snapshot preserves the original Httpx history. For the installable HTTPClient module, see HTTPClient v0.1.0.

HTTPClient v1.1.0

Choose a tag to compare

@cmilesio cmilesio released this 29 Dec 03:57
1698ed9

What's Changed

Full Changelog: goforj/httpx@v1.0.0...v1.1.0

This snapshot preserves the original Httpx history. For the installable HTTPClient module, see HTTPClient v0.1.0.

HTTPClient v1.0.0

Choose a tag to compare

@cmilesio cmilesio released this 26 Dec 23:10

Full Changelog: https://github.com/goforj/httpx/commits/v1.0.0

This snapshot preserves the original Httpx history. For the installable HTTPClient module, see HTTPClient v0.1.0.