Merge branch '1.3' into 2.0

Conflicts:
	cake/dispatcher.php
	cake/tests/cases/libs/controller/components/request_handler.test.php
This commit is contained in:
mark_story 2010-06-30 22:47:27 -04:00
commit 2020675078
16 changed files with 250 additions and 49 deletions

View file

@ -672,7 +672,6 @@ class RequestHandlerComponent extends Object {
* like 'application/x-shockwave'.
* @param array $options If $type is a friendly type name that is associated with
* more than one type of content, $index is used to select which content-type to use.
*
* @return boolean Returns false if the friendly type name given in $type does
* not exist in the type map, or if the Content-type header has
* already been set by this method.
@ -681,9 +680,6 @@ class RequestHandlerComponent extends Object {
*/
function respondAs($type, $options = array()) {
$this->__initializeTypes();
if ($this->__responseTypeSet != null) {
return false;
}
if (!array_key_exists($type, $this->__requestContent) && strpos($type, '/') === false) {
return false;
}
@ -720,10 +716,10 @@ class RequestHandlerComponent extends Object {
$header .= '; charset=' . $options['charset'];
}
if (!empty($options['attachment'])) {
header("Content-Disposition: attachment; filename=\"{$options['attachment']}\"");
$this->_header("Content-Disposition: attachment; filename=\"{$options['attachment']}\"");
}
if (Configure::read() < 2 && !defined('CAKEPHP_SHELL')) {
@header($header);
$this->_header($header);
}
$this->__responseTypeSet = $cType;
return true;
@ -731,6 +727,16 @@ class RequestHandlerComponent extends Object {
return false;
}
/**
* Wrapper for header() so calls can be easily tested.
*
* @param string $header The header to be sent.
* @return void
*/
protected function _header($header) {
header($header);
}
/**
* Returns the current response type (Content-type header), or null if none has been set
*