From 20efb240032b13efe0cfe9ab356dcd3210e80ec3 Mon Sep 17 00:00:00 2001 From: DBT Date: Wed, 25 Feb 2026 15:57:13 +0000 Subject: [PATCH] cron web api: use POST for create/update/delete actions --- pkg/nodes/registry_server.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/pkg/nodes/registry_server.go b/pkg/nodes/registry_server.go index d03e437..6071569 100644 --- a/pkg/nodes/registry_server.go +++ b/pkg/nodes/registry_server.go @@ -361,7 +361,7 @@ func (s *RegistryServer) handleWebUICron(w http.ResponseWriter, r *http.Request) } else { _ = json.NewEncoder(w).Encode(map[string]interface{}{"ok": true, "job": res}) } - case http.MethodPost, http.MethodPut, http.MethodDelete: + case http.MethodPost: args := map[string]interface{}{} if r.Body != nil { _ = json.NewDecoder(r.Body).Decode(&args) @@ -369,17 +369,9 @@ func (s *RegistryServer) handleWebUICron(w http.ResponseWriter, r *http.Request) if id := strings.TrimSpace(r.URL.Query().Get("id")); id != "" { args["id"] = id } - action := "" - switch r.Method { - case http.MethodPost: - action = "create" - if a, ok := args["action"].(string); ok && strings.TrimSpace(a) != "" { - action = strings.ToLower(strings.TrimSpace(a)) - } - case http.MethodPut: - action = "update" - case http.MethodDelete: - action = "delete" + action := "create" + if a, ok := args["action"].(string); ok && strings.TrimSpace(a) != "" { + action = strings.ToLower(strings.TrimSpace(a)) } res, err := s.onCron(action, args) if err != nil {