Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tv42/mockhttp

Mock object for Go http.ResponseWriter
https://github.com/tv42/mockhttp

Last synced: 2 months ago
JSON representation

Mock object for Go http.ResponseWriter

Awesome Lists containing this project

README

        

# mockhttp -- 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.