Handle json error in Login().

This commit is contained in:
Yang Luo
2021-06-09 19:54:26 +08:00
parent 4162ab4984
commit 04a246355e

View File

@ -94,7 +94,10 @@ func (c *ApiController) Login() {
var form RequestForm
err := json.Unmarshal(c.Ctx.Input.RequestBody, &form)
if err != nil {
panic(err)
resp = &Response{Status: "error", Msg: err.Error()}
c.Data["json"] = resp
c.ServeJSON()
return
}
if form.Username != "" {