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
+2 -2
View File
@@ -207,7 +207,7 @@ func GetCustomServices(w http.ResponseWriter, r *http.Request) {
func CreateCustomService(w http.ResponseWriter, r *http.Request) {
var req CreateCustomServiceRequest
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 {
@@ -326,7 +326,7 @@ func UpdateCustomService(w http.ResponseWriter, r *http.Request) {
var req UpdateCustomServiceRequest
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 {