fix: prevent internal error details leaking in HTTP responses

Replace err.Error() concatenation in JSON decode error responses with fixed 'invalid request body' message across 5 locations in custom_services.go, discount_campaigns.go, and services.go.
This commit is contained in:
2026-08-22 00:34:48 +01:00
parent 291868f11a
commit 5ed24f263a
3 changed files with 5 additions and 6 deletions
+1 -2
View File
@@ -101,10 +101,9 @@ func ToggleService(w http.ResponseWriter, r *http.Request) {
// POST /api/admin/services
func CreateServiceHandler(w http.ResponseWriter, r *http.Request) {
// Parse and validate request
var req CreateServiceRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, "Invalid JSON: "+err.Error(), http.StatusBadRequest)
http.Error(w, "invalid request body", http.StatusBadRequest)
return
}
if err := validators.Validate.Struct(&req); err != nil {