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

Skip to content

Commit 5994f69

Browse files
committed
merged branch Inori/patch-3 (PR #8876)
This PR was merged into the master branch. Discussion ---------- [HttpFoundation] add test to ensure Content-Length is preserved on HEAD | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Related to #8873 Commits ------- 42f0596 [HttpFoundation] add test to ensure that Content-Length is preserved on HEAD method
2 parents 803c0b7 + 42f0596 commit 5994f69

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
@@ -418,9 +418,12 @@ public function testPrepareRemovesContentForHeadRequests()
418418
$response = new Response('foo');
419419
$request = Request::create('/', 'HEAD');
420420

421+
$length = 12345;
422+
$response->headers->set('Content-Length', $length);
421423
$response->prepare($request);
422424

423425
$this->assertEquals('', $response->getContent());
426+
$this->assertEquals($length, $response->headers->get('Content-Length'), 'Content-Length should be as if it was GET; see RFC2616 14.13');
424427
}
425428

426429
public function testPrepareRemovesContentForInformationalResponse()

0 commit comments

Comments
 (0)