finds.dev← search

// the find

gavv/httpexpect

★ 2,721 · Go · MIT · updated Nov 2025

End-to-end HTTP and REST API testing for Go.

httpexpect is a fluent assertion library for Go HTTP API testing. It wraps net/http with a chainable builder API so you can construct requests and assert on responses in one readable expression. Good fit for teams writing integration tests against REST APIs or HTTP handlers directly without spinning up a full test server.

The handler binder (NewBinder/NewFastBinder) lets you test http.Handler and fasthttp.RequestHandler directly without a network round-trip, which is the right default for unit-style integration tests. JSONPath and JSON Schema validation are built in, not bolted on — useful for asserting shapes of large response bodies without decoding into structs. Retry and redirect policies are first-class, configurable per-request, which saves a lot of boilerplate in tests against eventually-consistent systems. The shared Env() bag lets sequential subtests pass values without globals or closures, which is a legitimate problem in ordered API test flows.

The dependency list is heavy for a test library — gorilla/websocket, gojsonschema, gojsondiff, go-querystring, and more. That's a lot of transitive surface area to drag into your test binary and keep up to date. JSONPath support is limited to a subset via the yalp/jsonpath package, which is largely unmaintained; complex path expressions will silently fail or return wrong results. The Env() shared state model is global to the httpexpect instance, so parallel subtests will race on it — the docs don't warn you about this. No built-in support for gRPC or GraphQL, so if your API is anything other than plain HTTP/JSON, this library stops helping immediately.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →