diff --git a/src/net/http/server.go b/src/net/http/server.go index f456e43cce..017a818846 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -33,8 +33,6 @@ import ( "golang.org/x/net/http/httpguts" ) -// TODO(jba): test - // Errors used by the HTTP server. var ( // ErrBodyNotAllowed is returned by ResponseWriter.Write calls diff --git a/src/net/http/server_test.go b/src/net/http/server_test.go index d418573452..e81e3bb6b0 100644 --- a/src/net/http/server_test.go +++ b/src/net/http/server_test.go @@ -118,6 +118,20 @@ func TestFindHandler(t *testing.T) { } } +func TestEmptyServeMux(t *testing.T) { + // Verify that a ServeMux with nothing registered + // doesn't panic. + mux := NewServeMux() + var r Request + r.Method = "GET" + r.Host = "example.com" + r.URL = &url.URL{Path: "/"} + _, p := mux.Handler(&r) + if p != "" { + t.Errorf(`got %q, want ""`, p) + } +} + func TestRegisterErr(t *testing.T) { mux := NewServeMux() h := &handler{}