Mock object for Go http.ResponseWriter
Go
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit ahead, 7 commits behind tv42:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitattributes
.gitignore
Makefile
README.rst
mockhttp_test.go
mockrequest.go
mockresponsewriter.go

README.rst

mockhttp.go -- Go package for unit testing HTTP serving

Unit testing HTTP services written in Go means you need to call their ServeHTTP receiver. For this, you need something that fulfills the http.ResponseWriter interface, and you need to populate a http.Request struct with suitable-looking data. mockhttp.go helps you do these tasks, without excessive copy-pasting.

See mockhttp_test.go for an example of usage.