Skip to content

Commit

Permalink
bugfix: restful api url should support both with version info and wit…
Browse files Browse the repository at this point in the history
…hout version info

Signed-off-by: Michael Wan <zirenwan@gmail.com>
  • Loading branch information
HusterWan committed Apr 2, 2018
1 parent 85d808d commit 0352085
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apis/server/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func initRoute(s *Server) http.Handler {

// metrics
r.Path(versionMatcher + "/metrics").Methods(http.MethodGet).Handler(prometheus.Handler())
r.Path("/metrics").Methods(http.MethodGet).Handler(prometheus.Handler())

if s.Config.Debug {
profilerSetup(r)
Expand All @@ -83,6 +84,7 @@ func initRoute(s *Server) http.Handler {

func addRoute(r *mux.Router, mothod string, path string, f func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error) {
r.Path(versionMatcher + path).Methods(mothod).Handler(filter(f))
r.Path(path).Methods(mothod).Handler(filter(f))
}

func profilerSetup(mainRouter *mux.Router) {
Expand Down

0 comments on commit 0352085

Please sign in to comment.