Whoops, return the value of httputil.UnmarshalJSON

This commit is contained in:
Neil Alexander 2022-03-28 10:32:27 +01:00
parent de9f68f60f
commit 022071e17e
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -551,10 +551,7 @@ func Register(
r.InhibitLogin = data.InhibitLogin r.InhibitLogin = data.InhibitLogin
} }
if resErr := httputil.UnmarshalJSON(reqBody, &r); resErr != nil { if resErr := httputil.UnmarshalJSON(reqBody, &r); resErr != nil {
return util.JSONResponse{ return *resErr
Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("Request body contains invalid JSON"),
}
} }
if req.URL.Query().Get("kind") == "guest" { if req.URL.Query().Get("kind") == "guest" {
return handleGuestRegistration(req, r, cfg, userAPI) return handleGuestRegistration(req, r, cfg, userAPI)