mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API Remove content-length setting in HTTPResponse
It's not reliable. Started in c69381c33, but only partially reverted.
This commit is contained in:
parent
7c0240cec1
commit
e6fffb9ef9
@ -150,10 +150,6 @@ class SS_HTTPResponse {
|
||||
|
||||
public function setBody($body) {
|
||||
$this->body = $body;
|
||||
|
||||
// Set content-length in bytes. Use mbstring to avoid problems with
|
||||
// mb_internal_encoding() and mbstring.func_overload
|
||||
$this->headers['Content-Length'] = mb_strlen($this->body,'8bit');
|
||||
}
|
||||
|
||||
public function getBody() {
|
||||
|
@ -13,21 +13,4 @@ class HTTPResponseTest extends SapphireTest {
|
||||
);
|
||||
}
|
||||
|
||||
public function testContentLengthHeader() {
|
||||
$r = new SS_HTTPResponse('123ü');
|
||||
$this->assertNotNull($r->getHeader('Content-Length'), 'Content-length header is added');
|
||||
$this->assertEquals(
|
||||
5,
|
||||
$r->getHeader('Content-Length'),
|
||||
'Header matches actual content length in bytes'
|
||||
);
|
||||
|
||||
$r->setBody('1234ü');
|
||||
$this->assertEquals(
|
||||
6,
|
||||
$r->getHeader('Content-Length'),
|
||||
'Header is updated when body is changed'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user