Skip to content

Commit

Permalink
Merge pull request kriswallsmith#51 from Seldaek/ci_header
Browse files Browse the repository at this point in the history
Match headers case insensitively
  • Loading branch information
kriswallsmith committed Mar 13, 2012
2 parents c7167a5 + 623c622 commit 5abb44b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Buzz/Message/AbstractMessage.php
Expand Up @@ -21,7 +21,7 @@ public function getHeader($name, $glue = "\r\n")

$values = array();
foreach ($this->getHeaders() as $header) {
if (0 === strpos($header, $needle)) {
if (0 === stripos($header, $needle)) {
$values[] = trim(substr($header, strlen($needle)));
}
}
Expand Down
8 changes: 8 additions & 0 deletions test/Buzz/Test/Message/AbstractMessageTest.php
Expand Up @@ -28,6 +28,14 @@ public function testGetHeaderReturnsNullIfHeaderDoesNotExist()
$this->assertNull($message->getHeader('X-Nonexistant'));
}

public function testGetHeaderIsCaseInsensitive()
{
$message = new Message();
$message->addHeader('X-zomg: test');

$this->assertEquals('test', $message->getHeader('X-ZOMG'));
}

public function testToStringFormatsTheMessage()
{
$message = new Message();
Expand Down

0 comments on commit 5abb44b

Please sign in to comment.