API Remove content-length setting in HTTPResponse

It's not reliable. Started in c69381c33, but only partially reverted.
This commit is contained in:
Ingo Schommer 2013-02-27 10:06:50 +01:00
parent 7c0240cec1
commit e6fffb9ef9
2 changed files with 0 additions and 21 deletions

View File

@ -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() {

View File

@ -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'
);
}
}