diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 1a169b60b..319a5ac25 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -828,7 +828,8 @@ class Controller extends Object { $this->autoRender = false; $this->View = $View; - return $this->response->body($View->render($view, $layout)); + $this->response->body($View->render($view, $layout)); + return $this->response; } /** diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index 6403465b1..99791e7b4 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -151,8 +151,11 @@ class Dispatcher { } $result = call_user_func_array(array(&$controller, $request->params['action']), $request->params['pass']); + if ($result instanceof CakeResponse) { + $response = $result; + } if ($controller->autoRender) { - $controller->render(); + $response = $controller->render(); } elseif ($response->body() === null) { $response->body($result); }