mirror of
https://github.com/cbeuw/Cloak.git
synced 2024-11-17 15:25:30 +00:00
Rename handlers
This commit is contained in:
parent
09bdae2584
commit
8ff0f3d17e
@ -53,9 +53,9 @@ func corsMiddleware(next http.Handler) http.Handler {
|
|||||||
func (manager *localManager) registerMux() *gmux.Router {
|
func (manager *localManager) registerMux() *gmux.Router {
|
||||||
r := gmux.NewRouter()
|
r := gmux.NewRouter()
|
||||||
r.HandleFunc("/admin/users", manager.listAllUsersHlr).Methods("GET")
|
r.HandleFunc("/admin/users", manager.listAllUsersHlr).Methods("GET")
|
||||||
r.HandleFunc("/admin/users/{UID}", manager.getUserInfo).Methods("GET")
|
r.HandleFunc("/admin/users/{UID}", manager.getUserInfoHlr).Methods("GET")
|
||||||
r.HandleFunc("/admin/users/{UID}", manager.writeUserInfo).Methods("POST")
|
r.HandleFunc("/admin/users/{UID}", manager.writeUserInfoHlr).Methods("POST")
|
||||||
r.HandleFunc("/admin/users/{UID}", manager.deleteUser).Methods("DELETE")
|
r.HandleFunc("/admin/users/{UID}", manager.deleteUserHlr).Methods("DELETE")
|
||||||
r.Use(corsMiddleware)
|
r.Use(corsMiddleware)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func (manager *localManager) listAllUsersHlr(w http.ResponseWriter, r *http.Requ
|
|||||||
_, _ = w.Write(resp)
|
_, _ = 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"]
|
b64UID := gmux.Vars(r)["UID"]
|
||||||
if b64UID == "" {
|
if b64UID == "" {
|
||||||
http.Error(w, "UID cannot be empty", http.StatusBadRequest)
|
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)
|
_, _ = 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"]
|
b64UID := gmux.Vars(r)["UID"]
|
||||||
if b64UID == "" {
|
if b64UID == "" {
|
||||||
http.Error(w, "UID cannot be empty", http.StatusBadRequest)
|
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)
|
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"]
|
b64UID := gmux.Vars(r)["UID"]
|
||||||
if b64UID == "" {
|
if b64UID == "" {
|
||||||
http.Error(w, "UID cannot be empty", http.StatusBadRequest)
|
http.Error(w, "UID cannot be empty", http.StatusBadRequest)
|
Loading…
Reference in New Issue
Block a user