Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42f0596

Browse files
committed
[HttpFoundation] add test to ensure that Content-Length is preserved on HEAD method
1 parent 32947b2 commit 42f0596

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,12 @@ public function testPrepareRemovesContentForHeadRequests()
361361
$response = new Response('foo');
362362
$request = Request::create('/', 'HEAD');
363363

364+
$length = 12345;
365+
$response->headers->set('Content-Length', $length);
364366
$response->prepare($request);
365367

366368
$this->assertEquals('', $response->getContent());
369+
$this->assertEquals($length, $response->headers->get('Content-Length'), 'Content-Length should be as if it was GET; see RFC2616 14.13');
367370
}
368371

369372
public function testPrepareSetsPragmaOnHttp10Only()

0 commit comments

Comments
 (0)