diff options
-rw-r--r-- | src/Config/Output.php | 2 | ||||
-rw-r--r-- | test/CsvTest.php | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Config/Output.php b/src/Config/Output.php index 27221d6..2e8bb15 100644 --- a/src/Config/Output.php +++ b/src/Config/Output.php @@ -179,7 +179,7 @@ trait Output { 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\""); } diff --git a/test/CsvTest.php b/test/CsvTest.php index 32115fb..f25a430 100644 --- a/test/CsvTest.php +++ b/test/CsvTest.php @@ -94,7 +94,10 @@ class CsvTest extends AbstractTestCase } $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"'); } |