refactor(webui): decode JSON request bodies with generic decodeBody

This commit is contained in:
sam committed 2026-10-10 11:05:58 +11:00
1 parent 3f76f15daa
commit 2aacac2495
7 files changed
+35 -40

No files matched your search

+2 -3
View File
@@ -47,9 +47,8 @@ func (s *Server) handleWorkflowEnabled(w http.ResponseWriter, r *http.Request) {
http.Error(w, "control plane unavailable", http.StatusServiceUnavailable)
return
}
var request workflowEnabledRequest
if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
http.Error(w, "invalid request body", http.StatusBadRequest)
request, ok := decodeBody[workflowEnabledRequest](w, r)
if !ok {
return
}
id := r.PathValue("id")