HTTP assertions made easy for Go via goreq
We love nodejs supertest module and we wanted something like that for Go.
Because we want to keep HTTP testing in Go plain simple.
import (
. "github.com/franela/goblin"
. "github.com/franela/go-supertest"
)
func MyTest(t *testing.T) {
g := Goblin(t)
g.Describe("GET /", function() {
g.It("Should respond 200", function(done Done) {
NewRequest("http://example.com").
Get("/").
Expect(200, done)
})
})
}
Assert response status
code.
Assert response status
code and body
.
Inspired by supertest.