Awesome Go

mockhttp

CategoryTesting
SubcategoryMock
Stars0

Mock object for Go http.ResponseWriter

About mockhttp

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.

Frequently Asked Questions

What is mockhttp?

mockhttp is a Testing library for the Go programming language. Mock object for Go http.ResponseWriter

How do I install mockhttp?

Install mockhttp with the Go module system using `go get tv42/mockhttp`. Check the repository for the current installation instructions.

What category does mockhttp belong to?

mockhttp is listed under Testing, specifically Mock.

← Back to Mock