mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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
This commit is contained in:
parent
1acbf15c00
commit
e7c7008781
2 changed files with 2 additions and 15 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue