Merge pull request #6965 from dy-dx/backport-csv-mapping

Don't map text/plain to csv. Backport from 3.0. Refs #1696
This commit is contained in:
Mark Story 2015-07-07 22:07:02 -04:00
commit 97656d8edb
2 changed files with 15 additions and 1 deletions

View file

@ -96,7 +96,7 @@ class CakeResponse {
'cpio' => 'application/x-cpio',
'cpt' => 'application/mac-compactpro',
'csh' => 'application/x-csh',
'csv' => array('text/csv', 'application/vnd.ms-excel', 'text/plain'),
'csv' => array('text/csv', 'application/vnd.ms-excel'),
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dms' => 'application/octet-stream',

View file

@ -197,6 +197,20 @@ class RequestHandlerComponentTest extends CakeTestCase {
$this->assertEquals('json', $this->RequestHandler->ext);
}
/**
* Test that RequestHandler does not set extension to csv for text/plain mimetype
*
* @return void
*/
public function testInitializeContentTypeWithjQueryTextPlainAccept() {
$_SERVER['HTTP_ACCEPT'] = 'text/plain, */*; q=0.01';
$this->assertNull($this->RequestHandler->ext);
Router::parseExtensions('csv');
$this->RequestHandler->initialize($this->Controller);
$this->assertNull($this->RequestHandler->ext);
}
/**
* Test that RequestHandler sets $this->ext when jQuery sends its wonky-ish headers
* and the application is configured to handle multiple extensions