return json errors on API invalid hook creation
This commit is contained in:
parent
92cda07085
commit
6717e49651
|
@ -86,9 +86,12 @@ object Setup extends LilaController with TheftPrevention with play.api.http.Cont
|
|||
|
||||
def hook(uid: String) = OpenBody { implicit ctx =>
|
||||
implicit val req = ctx.body
|
||||
env.forms.hook(ctx).bindFromRequest.value ?? { config =>
|
||||
env.processor.hook(config, uid, lila.common.HTTPRequest sid req)
|
||||
}
|
||||
env.forms.hook(ctx).bindFromRequest.fold(
|
||||
err => negotiate(
|
||||
html = BadRequest("Invalid form data").fuccess,
|
||||
api = _ => BadRequest(err.errorsAsJson).fuccess),
|
||||
config => env.processor.hook(config, uid, lila.common.HTTPRequest sid req)
|
||||
)
|
||||
}
|
||||
|
||||
def filterForm = Open { implicit ctx =>
|
||||
|
|
Loading…
Reference in a new issue