zhuqi-lucas commented on code in PR #530:
URL: https://github.com/apache/yunikorn-core/pull/530#discussion_r1184556750
##########
pkg/webservice/webservice.go:
##########
@@ -41,26 +42,29 @@ type WebService struct {
httpServer *http.Server
}
-func newRouter() *mux.Router {
- router := mux.NewRouter().StrictSlash(true)
+func newRouter() *httprouter.Router {
+ router := httprouter.New()
for _, webRoute := range webRoutes {
handler := loggingHandler(webRoute.HandlerFunc, webRoute.Name)
- router.
- Methods(webRoute.Method).
- Path(webRoute.Pattern).
- Name(webRoute.Name).
- Handler(handler)
+ switch webRoute.Method {
+ case "GET":
+ router.HandlerFunc(http.MethodGet, webRoute.Pattern,
handler)
+ case "PUT":
+ router.HandlerFunc(http.MethodPut, webRoute.Pattern,
handler)
+ case "POST":
+ router.HandlerFunc(http.MethodPost, webRoute.Pattern,
handler)
+ }
Review Comment:
My bad, this is more reasonable! Thank you @wilfred-s !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]