diff --git a/control/HTTPResponse.php b/control/HTTPResponse.php index b45c72653..e7482bb09 100644 --- a/control/HTTPResponse.php +++ b/control/HTTPResponse.php @@ -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() { diff --git a/tests/control/HTTPResponseTest.php b/tests/control/HTTPResponseTest.php index f2f37c693..8b8d38b98 100644 --- a/tests/control/HTTPResponseTest.php +++ b/tests/control/HTTPResponseTest.php @@ -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' - ); - } - }