used json.valid()

This commit is contained in:
Prateek Sachan 2020-03-28 12:00:32 +05:30
parent 6b89e214d3
commit 292f019467

View file

@ -92,8 +92,7 @@ func SaveAccountData(
return httputil.LogThenError(req, err)
}
var rawJson json.RawMessage
if err = json.Unmarshal(body, &rawJson); err != nil {
if !json.Valid(body) {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("Bad JSON content"),