1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-17 18:36:32 +02:00

Default to html when no content-type is set

This commit is contained in:
Jordi Boggiano
2016-03-04 17:19:59 +00:00
parent 88e483a815
commit d68b63a0d0

View File

@@ -104,6 +104,10 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
/** /**
* Checks the format of the response * Checks the format of the response
* *
* If Content-Type is set to application/javascript or text/javascript -> js
* If Content-Type is set to text/html, or is unset -> html
* If Content-Type is anything else -> unknown
*
* @return string One of 'js', 'html' or 'unknown' * @return string One of 'js', 'html' or 'unknown'
*/ */
protected static function getResponseFormat() protected static function getResponseFormat()
@@ -115,14 +119,15 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
// text/javascript is obsolete in favour of application/javascript, but still used // text/javascript is obsolete in favour of application/javascript, but still used
if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) { if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
return 'js'; return 'js';
} elseif (stripos($header, 'text/html') !== false) { }
return 'html'; if (stripos($header, 'text/html') === false) {
return 'unknown';
} }
break; break;
} }
} }
return 'unknown'; return 'html';
} }
private static function generateScript() private static function generateScript()