[HttpFoundation] Fixed messed up headers

This commit is contained in:
Bart van den Burg 2013-02-26 09:53:49 +01:00 committed by Fabien Potencier
parent b9d3d076a6
commit 850bd5a06b
2 changed files with 16 additions and 0 deletions

View File

@ -67,6 +67,8 @@ class ResponseHeaderBag extends HeaderBag
$cookies .= 'Set-Cookie: '.$cookie."\r\n";
}
ksort($this->headerNames);
return parent::__toString().$cookies;
}

View File

@ -235,6 +235,20 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $headers->makeDisposition($disposition, $filename, $filenameFallback));
}
public function testToStringDoesntMessUpHeaders()
{
$headers = new ResponseHeaderBag();
$headers->set('Location', 'http://www.symfony.com');
$headers->set('Content-type', 'text/html');
(string) $headers;
$allHeaders = $headers->allPreserveCase();
$this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']);
$this->assertEquals(array('text/html'), $allHeaders['Content-type']);
}
public function provideMakeDisposition()
{
return array(