Skip to content

Commit

Permalink
Changing behavior of RequestHandlerComponent::responseType(), it will…
Browse files Browse the repository at this point in the history
… return the current content type set int the response object

It will not return null as default as it did prior 2.0
  • Loading branch information
lorenzo committed Aug 2, 2010
1 parent 1acbf15 commit e7c7008
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions cake/libs/controller/components/request_handler.php
Expand Up @@ -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
*
Expand Down Expand Up @@ -566,7 +557,6 @@ function respondAs($type, $options = array()) {
if (!empty($options['attachment'])) {
$this->response->download($options['attachment']);
}
$this->__responseTypeSet = $cType;
return true;
}
return false;
Expand All @@ -579,10 +569,7 @@ function respondAs($type, $options = array()) {
* otherwise null
*/
public function responseType() {
if ($this->__responseTypeSet == null) {
return null;
}
return $this->mapType($this->__responseTypeSet);
return $this->mapType($this->response->type());
}

/**
Expand Down
Expand Up @@ -442,7 +442,7 @@ function testRequestContentTypes() {
* @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');
}
Expand Down

0 comments on commit e7c7008

Please sign in to comment.