diff --git a/http/http.go b/http/http.go index 7dd79e9..ed2fef6 100644 --- a/http/http.go +++ b/http/http.go @@ -62,7 +62,7 @@ func makeHandler(handler ResponseHandler) httprouter.Handle { } } -func setupRoutes(t *Tracker, cfg *config.Config) *httprouter.Router { +func NewRouter(t *Tracker, cfg *config.Config) *httprouter.Router { r := httprouter.New() if cfg.Private { @@ -94,7 +94,7 @@ func Serve(cfg *config.Config) { glog.Fatal("New: ", err) } - graceful.Run(cfg.Addr, cfg.RequestTimeout.Duration, setupRoutes(t, cfg)) + graceful.Run(cfg.Addr, cfg.RequestTimeout.Duration, NewRouter(t, cfg)) } func fail(w http.ResponseWriter, r *http.Request, err error) { diff --git a/http/http_test.go b/http/http_test.go index 10cea53..f3b3769 100644 --- a/http/http_test.go +++ b/http/http_test.go @@ -31,7 +31,7 @@ func setupTracker(cfg *config.Config) (*httptest.Server, error) { } func createServer(tkr *Tracker, cfg *config.Config) (*httptest.Server, error) { - return httptest.NewServer(setupRoutes(tkr, cfg)), nil + return httptest.NewServer(NewRouter(tkr, cfg)), nil } func announce(p params, srv *httptest.Server) ([]byte, error) {