func DecodeJSONBody()

in api/pkg/handler/json.go [45:54]


func DecodeJSONBody(r *http.Request, v interface{}) error {
	if err := json.NewDecoder(r.Body).Decode(v); err != nil {
		return Errorf(r.Context(),
			http.StatusBadRequest, "invalid json",
			"failed to decode request body as json: %w", err)
	}
	defer r.Body.Close()

	return nil
}