Skip to content

Commit

Permalink
Changed Content-Type header to text/csv re: RFC 7111
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris Reeck committed Sep 1, 2016
1 parent b9a0998 commit b61b7d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Config/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function output($filename = null)
{
if (null !== $filename) {
$filename = filter_var($filename, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
header('Content-Type: application/octet-stream');
header('Content-Type: text/csv');
header('Content-Transfer-Encoding: binary');
header("Content-Disposition: attachment; filename=\"$filename\"");
}
Expand Down
5 changes: 4 additions & 1 deletion test/CsvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ public function testOutputHeaders()
}
$this->csv->output('test.csv');
$headers = \xdebug_get_headers();
$this->assertSame($headers[0], 'Content-Type: application/octet-stream');

// Due to the variety of ways the xdebug expresses Content-Type of text files,
// we cannot count on complete string matching.
$this->assertContains('content-type: text/csv', strtolower($headers[0]));
$this->assertSame($headers[1], 'Content-Transfer-Encoding: binary');
$this->assertSame($headers[2], 'Content-Disposition: attachment; filename="test.csv"');
}
Expand Down

0 comments on commit b61b7d6

Please sign in to comment.