1
0
Эх сурвалжийг харах

wrap request read error as bad request

Aneurin Barker Snook 1 жил өмнө
parent
commit
33eba7de84
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  1. 1 1
      body.go

+ 1 - 1
body.go

@@ -11,7 +11,7 @@ import (
 func ReadRequestJSON(req *http.Request, v any) error {
 func ReadRequestJSON(req *http.Request, v any) error {
 	data, err := io.ReadAll(req.Body)
 	data, err := io.ReadAll(req.Body)
 	if err != nil {
 	if err != nil {
-		return err
+		return ErrBadRequest.WithError(err)
 	}
 	}
 	return json.Unmarshal(data, v)
 	return json.Unmarshal(data, v)
 }
 }