From e7c70087811ccded742f3c8daf43f9f63a1320a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Mon, 2 Aug 2010 19:21:52 -0430 Subject: [PATCH] Changing behavior of RequestHandlerComponent::responseType(), it will return the current content type set int the response object It will not return null as default as it did prior 2.0 --- .../controller/components/request_handler.php | 15 +-------------- .../components/request_handler.test.php | 2 +- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index 48d656e8c..42193d4b9 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -47,15 +47,6 @@ class RequestHandlerComponent extends Object { */ public $enabled = true; -/** - * Holds the content-type of the response that is set when using - * RequestHandler::respondAs() - * - * @var string - * @access private - */ - private $__responseTypeSet = null; - /** * Holds the reference to Controller::$request * @@ -566,7 +557,6 @@ class RequestHandlerComponent extends Object { if (!empty($options['attachment'])) { $this->response->download($options['attachment']); } - $this->__responseTypeSet = $cType; return true; } return false; @@ -579,10 +569,7 @@ class RequestHandlerComponent extends Object { * otherwise null */ public function responseType() { - if ($this->__responseTypeSet == null) { - return null; - } - return $this->mapType($this->__responseTypeSet); + return $this->mapType($this->response->type()); } /** diff --git a/cake/tests/cases/libs/controller/components/request_handler.test.php b/cake/tests/cases/libs/controller/components/request_handler.test.php index e9de5b697..997cb3eeb 100644 --- a/cake/tests/cases/libs/controller/components/request_handler.test.php +++ b/cake/tests/cases/libs/controller/components/request_handler.test.php @@ -442,7 +442,7 @@ class RequestHandlerComponentTest extends CakeTestCase { * @return void */ function testResponseContentType() { - $this->assertNull($this->RequestHandler->responseType()); + $this->assertEquals('html', $this->RequestHandler->responseType()); $this->assertTrue($this->RequestHandler->respondAs('atom')); $this->assertEqual($this->RequestHandler->responseType(), 'atom'); }