Skip to content

Commit

Permalink
Fix validation errors formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
erickskrauch committed Jun 10, 2024
1 parent ce6e62a commit 62b6ac8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/http/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ func (p *ProfilesApi) postProfileHandler(resp http.ResponseWriter, req *http.Req
// Manager returns ValidationError according to the struct fields names.
// They are uppercased, but otherwise the same as the names in the API.
// So to make them consistent it's enough just to make the first lowercased.
newErrors := make(map[string][]string, len(v.Errors))
for field, errors := range v.Errors {
v.Errors[xstrings.FirstRuneToLower(field)] = errors
delete(v.Errors, field)
newErrors[xstrings.FirstRuneToLower(field)] = errors
}

apiBadRequest(resp, v.Errors)
apiBadRequest(resp, newErrors)

return
}
Expand Down

0 comments on commit 62b6ac8

Please sign in to comment.