From 022071e17ef23d9f197a690d2c2eee051c5a2516 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 28 Mar 2022 10:32:27 +0100 Subject: [PATCH] Whoops, return the value of `httputil.UnmarshalJSON` --- clientapi/routing/register.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go index c2a44c854..d5b7f474d 100644 --- a/clientapi/routing/register.go +++ b/clientapi/routing/register.go @@ -551,10 +551,7 @@ func Register( r.InhibitLogin = data.InhibitLogin } if resErr := httputil.UnmarshalJSON(reqBody, &r); resErr != nil { - return util.JSONResponse{ - Code: http.StatusBadRequest, - JSON: jsonerror.BadJSON("Request body contains invalid JSON"), - } + return *resErr } if req.URL.Query().Get("kind") == "guest" { return handleGuestRegistration(req, r, cfg, userAPI)