refactor: use tryParseRequest
This commit is contained in:
parent
f3e43f522f
commit
9d843bffdb
|
@ -64,9 +64,7 @@ func hashPassword(password string) (string, error) {
|
||||||
func (a *AccountController) PostRegister() {
|
func (a *AccountController) PostRegister() {
|
||||||
var r RegisterRequest
|
var r RegisterRequest
|
||||||
|
|
||||||
if err := a.Ctx.ReadJSON(&r); err != nil {
|
if !tryParseRequest(r, a.Ctx) {
|
||||||
logger.Get().Debug("failed to parse request", zap.Error(err))
|
|
||||||
a.Ctx.StopWithError(iris.StatusBadRequest, err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue