Send charset in Content-Type when Content is JSON.

This commit is contained in:
frederikweber 2012-11-18 11:39:17 +01:00
parent 4ebe754076
commit ac0b9b285d

View file

@ -409,7 +409,7 @@ class CakeResponse {
if (in_array($this->_status, array(304, 204))) {
return;
}
if (strpos($this->_contentType, 'text/') === 0) {
if (strpos($this->_contentType, 'text/') === 0 || $this->_contentType === 'application/json') {
$this->header('Content-Type', "{$this->_contentType}; charset={$this->_charset}");
} else {
$this->header('Content-Type', "{$this->_contentType}");