From 89e078e698f076469235b20c122b1a4aefc1d8a5 Mon Sep 17 00:00:00 2001 From: kraktus Date: Mon, 25 Oct 2021 10:25:24 +0200 Subject: [PATCH] Better response when swiss is deleted while editing request is handled Now will return code status 404 instead of 200 with a `null` body. --- app/controllers/Swiss.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/Swiss.scala b/app/controllers/Swiss.scala index ef29709598..982c9baba4 100644 --- a/app/controllers/Swiss.scala +++ b/app/controllers/Swiss.scala @@ -231,7 +231,13 @@ final class Swiss( .bindFromRequest() .fold( newJsonFormError, - data => JsonOk { env.swiss.api.update(swiss.id, data) map (_.map(env.swiss.json.api)) } + data => { + env.swiss.api.update(swiss.id, data) map { + _ ?? { swiss => + JsonOk(env.swiss.json.api(swiss)) + } + } + } ) } }