Permalink
Browse files

[HttpFoundation] Fixed messed up headers

  • Loading branch information...
Bart van den Burg authored and fabpot committed Feb 26, 2013
1 parent b4f1360 commit 05436cd1d542f21da6ee67857cf88224e5f3acb1
Showing with 16 additions and 0 deletions.
  1. +2 −0 ResponseHeaderBag.php
  2. +14 −0 Tests/ResponseHeaderBagTest.php
View
@@ -67,6 +67,8 @@ public function __toString()
$cookies .= 'Set-Cookie: '.$cookie."\r\n";
}
+ ksort($this->headerNames);
+
return parent::__toString().$cookies;
}
@@ -235,6 +235,20 @@ public function testMakeDisposition($disposition, $filename, $filenameFallback,
$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(

0 comments on commit 05436cd

Please sign in to comment.