Skip to content

franela/go-supertest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

go-supertest

HTTP assertions made easy for Go via goreq

We love nodejs supertest module and we wanted something like that for Go.

Why?

Because we want to keep HTTP testing in Go plain simple.

Example

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)
    })
  })
}

API

.expect(status[, func])

Assert response status code.

.expect(status, body[, fn])

Assert response status code and body.

Notes

Inspired by supertest.

About

HTTP assertions made easy for Go via goreq

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages