Skip to content

Commit

Permalink
[HttpFoundation] Fixed messed up headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van den Burg authored and fabpot committed Feb 26, 2013
1 parent b9d3d07 commit 850bd5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
Expand Up @@ -67,6 +67,8 @@ public function __toString()
$cookies .= 'Set-Cookie: '.$cookie."\r\n";
}

ksort($this->headerNames);

return parent::__toString().$cookies;
}

Expand Down
Expand Up @@ -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(
Expand Down

0 comments on commit 850bd5a

Please sign in to comment.