mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #7763 from creative-commoners/pulls/4.0/fix-remove-header
FIX HTTPResponse::removeHeader incorrectly converts header name to lowercase
This commit is contained in:
commit
daac577e62
@ -245,7 +245,7 @@ class HTTPResponse
|
|||||||
*/
|
*/
|
||||||
public function removeHeader($header)
|
public function removeHeader($header)
|
||||||
{
|
{
|
||||||
strtolower($header);
|
$header = strtolower($header);
|
||||||
unset($this->headers[$header]);
|
unset($this->headers[$header]);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -47,4 +47,15 @@ class HTTPResponseTest extends SapphireTest
|
|||||||
// Fail if we get to here
|
// Fail if we get to here
|
||||||
$this->assertFalse(true, 'Something went wrong with our test exception');
|
$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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user