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/v2
Test an HTTP API endpoint
package main
import (
"net/http/httptest"
"testing"
"github.com/gavv/httpexpect/v2"
)
func TestAPI(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`{"message":"hello"}`))
}))
defer server.Close()
e := httpexpect.New(t, server.URL)
e.GET("/").Expect().Status(http.StatusOK).JSON().Object().ValueEqual("message", "hello")
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
2.17.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.