protected function _setContentType() { if (in_array($this->_status, [304, 204])) { return; } $whitelist = ['application/javascript', 'application/json', 'application/xml', 'application/rss+xml']; $charset = false; if ($this->_charset && (strpos($this->_contentType, 'text/') === 0 || in_array($this->_contentType, $whitelist))) { $charset = true; } if ($charset) { $this->header('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); } else { $this->header('Content-Type', "{$this->_contentType}"); } }