Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
httpexpect
✓ github.com/gavv/httpexpect
Test an HTTP handler with fluent assertions.
package main
import (
"net/http"
"testing"
"github.com/gavv/httpexpect"
)
func TestAPI(t *testing.T) {
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`{"message":"hello"}`))
})
e := httpexpect.WithConfig(httpexpect.Config{
BaseURL: "http://example.com",
Reporter: httpexpect.NewAssertReporter(t),
Client: &http.Client{Transport: httpexpect.NewBinder(handler)},
})
e.GET("/").
Expect().
Status(http.StatusOK).
JSON().Object().
ValueEqual("message", "hello")
}
Upgrade
Version history
2.0.0+incompatiblelatest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.