From 8ff0f3d17ed929eeacafd25b0260fcf7433133ef Mon Sep 17 00:00:00 2001 From: Qian Wang Date: Thu, 25 Jul 2019 13:09:36 +0100 Subject: [PATCH] Rename handlers --- internal/server/um_local.go | 6 +++--- internal/server/{um_local_api.go => um_local_hlr.go} | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename internal/server/{um_local_api.go => um_local_hlr.go} (94%) diff --git a/internal/server/um_local.go b/internal/server/um_local.go index 373aadf..ff50c13 100644 --- a/internal/server/um_local.go +++ b/internal/server/um_local.go @@ -53,9 +53,9 @@ func corsMiddleware(next http.Handler) http.Handler { func (manager *localManager) registerMux() *gmux.Router { r := gmux.NewRouter() r.HandleFunc("/admin/users", manager.listAllUsersHlr).Methods("GET") - r.HandleFunc("/admin/users/{UID}", manager.getUserInfo).Methods("GET") - r.HandleFunc("/admin/users/{UID}", manager.writeUserInfo).Methods("POST") - r.HandleFunc("/admin/users/{UID}", manager.deleteUser).Methods("DELETE") + r.HandleFunc("/admin/users/{UID}", manager.getUserInfoHlr).Methods("GET") + r.HandleFunc("/admin/users/{UID}", manager.writeUserInfoHlr).Methods("POST") + r.HandleFunc("/admin/users/{UID}", manager.deleteUserHlr).Methods("DELETE") r.Use(corsMiddleware) return r } diff --git a/internal/server/um_local_api.go b/internal/server/um_local_hlr.go similarity index 94% rename from internal/server/um_local_api.go rename to internal/server/um_local_hlr.go index 89a3ce0..2393ff2 100644 --- a/internal/server/um_local_api.go +++ b/internal/server/um_local_hlr.go @@ -45,7 +45,7 @@ func (manager *localManager) listAllUsersHlr(w http.ResponseWriter, r *http.Requ _, _ = w.Write(resp) } -func (manager *localManager) getUserInfo(w http.ResponseWriter, r *http.Request) { +func (manager *localManager) getUserInfoHlr(w http.ResponseWriter, r *http.Request) { b64UID := gmux.Vars(r)["UID"] if b64UID == "" { http.Error(w, "UID cannot be empty", http.StatusBadRequest) @@ -84,7 +84,7 @@ func (manager *localManager) getUserInfo(w http.ResponseWriter, r *http.Request) _, _ = w.Write(resp) } -func (manager *localManager) writeUserInfo(w http.ResponseWriter, r *http.Request) { +func (manager *localManager) writeUserInfoHlr(w http.ResponseWriter, r *http.Request) { b64UID := gmux.Vars(r)["UID"] if b64UID == "" { http.Error(w, "UID cannot be empty", http.StatusBadRequest) @@ -143,7 +143,7 @@ func (manager *localManager) writeUserInfo(w http.ResponseWriter, r *http.Reques w.WriteHeader(http.StatusCreated) } -func (manager *localManager) deleteUser(w http.ResponseWriter, r *http.Request) { +func (manager *localManager) deleteUserHlr(w http.ResponseWriter, r *http.Request) { b64UID := gmux.Vars(r)["UID"] if b64UID == "" { http.Error(w, "UID cannot be empty", http.StatusBadRequest)