/** * Render the headers of the generated response * If headers are not set already. Set them to application/json */ protected function setHeaders() { if (headers_sent()) { return; } header('Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0'); //prevent caching header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); //resolves problem with IE GET requests // Iframe hack, weird Content-Type crap is happening here if (\GO\Base\Util\Http::isMultipartRequest()) { header('Content-Type: text/html; charset=UTF-8'); } else { header('Content-type: application/json; charset=UTF-8'); //tell the browser we are returning json } }
/** * Default headers to send. */ protected function headers() { //iframe hack for file uploads fails with application/json if (!\GO\Base\Util\Http::isAjaxRequest(false) || \GO\Base\Util\Http::isMultipartRequest()) { header('Content-Type: text/html; charset=UTF-8'); } else { header('Content-Type: application/json; charset=UTF-8'); } foreach (\GO::config()->extra_headers as $header) { header($header); } }