Let's cover the basics of unit testing in Go and then show how you can test http.HandlerFunc and http.Handler.
You'll learn how to use "testing", including subtests and examples, and "net/http/httptest" with ResponseRecorder and Server.
References:
- testing: https://golang.org/pkg/testing/
- net/http/httptest: https://golang.org/pkg/net/http/httptest
- Testable Examples in Go: https://blog.golang.org/examples
- source code: https://github.com/campoy/justforfunc/tree/master/16-logpipe