Fix (most) PR comments

This commit is contained in:
Herman Slatman
2022-03-31 16:12:29 +02:00
parent bfa4d809fd
commit 571b21abbc
25 changed files with 682 additions and 714 deletions

View File

@@ -34,7 +34,7 @@ func ProtoJSON(r io.Reader, m proto.Message) error {
}
// ProtoJSONWithCheck reads JSON from the request body and stores it in the value
// pointed to by v. Returns false if an error was written; true if not.
// pointed to by m. Returns false if an error was written; true if not.
func ProtoJSONWithCheck(w http.ResponseWriter, r io.Reader, m proto.Message) bool {
data, err := io.ReadAll(r)
if err != nil {
@@ -57,6 +57,7 @@ func ProtoJSONWithCheck(w http.ResponseWriter, r io.Reader, m proto.Message) boo
if err := protojson.Unmarshal(data, m); err != nil {
if errors.Is(err, proto.Error) {
var wrapper = struct {
// TODO(hs): more properties in the error response?
Message string `json:"message"`
}{
Message: err.Error(),