mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
commit
97656d8edb
2 changed files with 15 additions and 1 deletions
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue