From a2557d2201bf7c5e7dd5ba44f59695072c13f843 Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Tue, 19 Sep 2023 11:21:13 +0200 Subject: [PATCH] :goal_net: catching 'No Content' error Co-authored-by: haraldnilsen --- backend/Controllers/MovieController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/Controllers/MovieController.cs b/backend/Controllers/MovieController.cs index 32b77db..032d649 100644 --- a/backend/Controllers/MovieController.cs +++ b/backend/Controllers/MovieController.cs @@ -29,6 +29,10 @@ public class MovieController: ControllerBase IEnumerable resultSkip = movies.Skip(pageSize * (pageNumber - 1)); IEnumerable resultTake = resultSkip.Take(pageSize); + if (resultTake.ToList().Count == 0) { + return StatusCode(204, "No Content"); + } + return Ok(resultTake); } catch (Exception ex)