FIX HTTPResponse::removeHeader incorrectly converts header name to lowercase

This commit is contained in:
Robbie Averill 2018-01-16 23:20:52 +13:00
parent 3312a68dc2
commit cc90cb0125
2 changed files with 12 additions and 1 deletions

View File

@ -245,7 +245,7 @@ class HTTPResponse
*/
public function removeHeader($header)
{
strtolower($header);
$header = strtolower($header);
unset($this->headers[$header]);
return $this;
}

View File

@ -47,4 +47,15 @@ class HTTPResponseTest extends SapphireTest
// Fail if we get to here
$this->assertFalse(true, 'Something went wrong with our test exception');
}
public function testRemoveHeader()
{
$response = new HTTPResponse();
$response->addHeader('X-Animal', 'Monkey');
$this->assertSame('Monkey', $response->getHeader('X-Animal'));
$response->removeHeader('X-Animal');
$this->assertEmpty($response->getHeader('X-Animal'));
}
}