From dd0ed02b91d553c67c9bba27025e65910a69b643 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Fri, 15 Nov 2024 10:09:59 +0100 Subject: [PATCH] feat(Dispatcher): Add debug log for controller methods returning raw data not wrapped in Response Signed-off-by: provokateurin --- lib/private/AppFramework/Http/Dispatcher.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index b7952df8d199b..e2750e30fa91a 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -208,6 +208,10 @@ private function executeController(Controller $controller, string $methodName): $response = \call_user_func_array([$controller, $methodName], $arguments); $this->eventLogger->end('controller:' . get_class($controller) . '::' . $methodName); + if (!($response instanceof Response)) { + $this->logger->debug($controller::class . '::' . $methodName . ' returned raw data. Please wrap it in a Response or one of it\'s inheritors.'); + } + // format response if ($response instanceof DataResponse || !($response instanceof Response)) { // get format from the url format or request format parameter