From 9d843bffdbb02e2627e91f3172057c228444c5d0 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 7 Jun 2023 08:49:07 -0400 Subject: [PATCH] refactor: use tryParseRequest --- controller/account.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/controller/account.go b/controller/account.go index 1f27162..bea69c2 100644 --- a/controller/account.go +++ b/controller/account.go @@ -64,9 +64,7 @@ func hashPassword(password string) (string, error) { func (a *AccountController) PostRegister() { var r RegisterRequest - if err := a.Ctx.ReadJSON(&r); err != nil { - logger.Get().Debug("failed to parse request", zap.Error(err)) - a.Ctx.StopWithError(iris.StatusBadRequest, err) + if !tryParseRequest(r, a.Ctx) { return }