httpexpect.v1: end-to-end HTTP API testing for Go

httpexpect is a new Go package for end-to-end HTTP and REST API testing.

It provides convenient chainable helpers for building HTTP request, sending it, and inspecting received HTTP response and its payload.

Links:

The key point is that request construction and response assertions become concise and declarative:

// create httpexpect instance
e := httpexpect.New(t, "http://example.com")

// check that "GET /fruits" returns empty JSON array
e.GET("/fruits").
    Expect().
    Status(http.StatusOK).JSON().Array().Empty()

You can find more examples in the Quick Start.

The first stable branch is released and available on gopkg: httpexpect.v1.

There is a compatibility promise for this branch.