Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/api/handlers/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@ func (h *HandlersApi) UserActionHandler(w http.ResponseWriter, r *http.Request)
}
}
returnData = "user removed successfully"
default:
// Reject unknown actions explicitly. Without this case an
// unrecognized action (e.g. "update") matches nothing, skips all
// branches, and still returns 200 with an empty payload — a silent
// no-op that looks like success while creating/editing nothing.
apiErrorResponse(w, "invalid action", http.StatusBadRequest, fmt.Errorf("unknown user action %q", actionVar))
return
}
// Serialize and serve JSON
log.Debug().Msgf("Returned [%s]", returnData)
Expand Down