public function testGetHeaders() { $response = new Response('foo'); $response->addHeader('bar'); $response->addHeader('baz'); $this->assertEquals(['bar', 'baz'], $response->getHeaders()); }
/** * @param File $file */ public function __construct(File $file) { parent::__construct($file->getContent()); $this->addHeader(sprintf('Content-Type: %s', $file->getType())); $this->addHeader(sprintf('Content-Length: %d', $file->getSize())); $this->addHeader(sprintf('Content-Disposition: attachment; filename="%s"', $file->getName())); }