Set Content-Type to 'application/json' for wildcard HTTP_ACCEPT

The Content-Type HTTP header should be set to application/json if HTTP_ACCEPT has application/json or is */*
This commit is contained in:
Corey Sewell 2014-09-05 09:25:36 +12:00
parent 013a4fde7b
commit 4cc7da8b7e

View File

@ -295,7 +295,7 @@ class GridFieldBulkUpload_Request extends RequestHandler
*/ */
protected function contentTypeNegotiation(&$response) protected function contentTypeNegotiation(&$response)
{ {
if (isset($_SERVER['HTTP_ACCEPT']) && (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) if (isset($_SERVER['HTTP_ACCEPT']) && ((strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false) || $_SERVER['HTTP_ACCEPT'] === '*/*' )) {
{ {
$response->addHeader('Content-Type', 'application/json'); $response->addHeader('Content-Type', 'application/json');
}else{ }else{