util/loghttp.go | 8 ++++++-- diff --git a/util/loghttp.go b/util/loghttp.go index ce6f1ef534d8c68732249378295fb9c2236a2e1a..399750aad4d06f221c18a759095b0dbf9e1c45d4 100644 --- a/util/loghttp.go +++ b/util/loghttp.go @@ -7,7 +7,7 @@ "net/http" _ "net/http/pprof" ) -func LoggedHTTPServe(addr string) { +func LoggedHTTPServe(addr string) *http.ServeMux { if addr == "" { addr = "localhost:6061" } @@ -27,11 +27,15 @@ if err != nil { log.Fatalf("error creating http conn: %#v", err) } log.Printf("starting http server on http://%s", conn.Addr()) + mux := http.NewServeMux() go func() { defer conn.Close() - err = (&http.Server{}).Serve(conn) + err = (&http.Server{ + Handler: mux, + }).Serve(conn) if err != nil { log.Fatalf("error serving http: %s", err) } }() + return mux }