From 14673ff1f5b444019d9ab8cd686dc293a7796b71 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Tue, 11 Oct 2022 15:24:42 +0200 Subject: [PATCH] Return HTTP 400 when operation is not found (instead of 404 page not found) --- .../Application/TwigBase/Controller/Controller.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sources/Application/TwigBase/Controller/Controller.php b/sources/Application/TwigBase/Controller/Controller.php index 6a2dad13b..5fa82ce0d 100644 --- a/sources/Application/TwigBase/Controller/Controller.php +++ b/sources/Application/TwigBase/Controller/Controller.php @@ -174,7 +174,7 @@ abstract class Controller } else { - $this->DisplayPageNotFound(); + $this->DisplayBadRequest(); } } catch (Exception $e) @@ -219,6 +219,15 @@ abstract class Controller } } + /** + * Overridable "page not found" which is more an "operation not found" + */ + public function DisplayBadRequest() + { + http_response_code(400); + die('Operation not found'); + } + /** * Overridable "page not found" which is more an "operation not found" */