From 3c3d4e60bbd1769e20ffd48b69796643ab488c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20R=C3=B6hrig?= Date: Thu, 3 Oct 2019 21:07:41 +0200 Subject: [PATCH] A recipe not found should result in a 404 --- lib/Controller/RecipeController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Controller/RecipeController.php b/lib/Controller/RecipeController.php index d5fead76..fbbbac23 100644 --- a/lib/Controller/RecipeController.php +++ b/lib/Controller/RecipeController.php @@ -106,6 +106,9 @@ class RecipeController extends Controller { public function get($id) { $json = $this->service->getRecipeById($id); + if(null === $json){ + return new DataResponse($id, Http::STATUS_NOT_FOUND, [ 'Content-Type' => 'application/json' ] ); + } return new DataResponse($json, Http::STATUS_OK, [ 'Content-Type' => 'application/json' ]); }