From 37234338955df969319cc9eca6202782bce5603a Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Thu, 14 Oct 2021 15:50:07 -0700 Subject: [PATCH] Remove trailing slash from RootPath output string --- README.md | 3 ++- handler.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 38185d5..135c11f 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,8 @@ func main() { RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"}, }) - http.Handle(h.RootPath(), h) + // Note: We need the tailing slash when using net/http.ServeMux. + http.Handle(h.RootPath()+"/", h) // Go to http://localhost:8080/monitoring to see asynqmon homepage. log.Fatal(http.ListenAndServe(":8080", nil)) diff --git a/handler.go b/handler.go index 4a440e8..0eb7cf6 100644 --- a/handler.go +++ b/handler.go @@ -78,8 +78,9 @@ func (h *HTTPHandler) Close() error { } // RootPath returns the root URL path used for asynqmon application. +// Returned path string does not have the trailing slash. func (h *HTTPHandler) RootPath() string { - return h.rootPath + "/" + return h.rootPath } //go:embed ui/build/*