Skip to content

Commit

Permalink
api: add part of deprecated APIs back (#4680)
Browse files Browse the repository at this point in the history
ref #4679

Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx authored Feb 27, 2022
1 parent d67ef6d commit a4b1968
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,10 @@ func createRouter(prefix string, svr *server.Server) *mux.Router {
}), setAuditBackend("test"))
})

// Deprecated: use /pd/api/v1/health instead.
rootRouter.Handle("/health", newHealthHandler(svr, rd)).Methods("GET")
// Deprecated: use /pd/api/v1/ping instead.
rootRouter.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {}).Methods("GET")

return rootRouter
}
6 changes: 6 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ func combineBuilderServerHTTPService(ctx context.Context, svr *Server, serviceBu
// If PathPrefix is not specified, register into apiService,
// and finally apiService is registered in userHandlers.
router.PathPrefix(pathPrefix).Handler(handler)
if info.IsCore {
// Deprecated
router.Path("/pd/health").Handler(handler)
// Deprecated
router.Path("/pd/ping").Handler(handler)
}
}
}
apiService.UseHandler(router)
Expand Down

0 comments on commit a4b1968

Please sign in to comment.