From: provokateurin Date: Fri, 15 Nov 2024 09:09:59 +0000 (+0100) Subject: feat(Dispatcher): Add debug log for controller methods returning raw data not wrapped... X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dd0ed02b91d553c67c9bba27025e65910a69b643;p=nextcloud-server.git feat(Dispatcher): Add debug log for controller methods returning raw data not wrapped in Response Signed-off-by: provokateurin --- diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index b7952df8d19..e2750e30fa9 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -208,6 +208,10 @@ class Dispatcher { $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