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
This commit is contained in:
commit
5994f69a97
@ -418,9 +418,12 @@ class ResponseTest extends ResponseTestCase
|
|||||||
$response = new Response('foo');
|
$response = new Response('foo');
|
||||||
$request = Request::create('/', 'HEAD');
|
$request = Request::create('/', 'HEAD');
|
||||||
|
|
||||||
|
$length = 12345;
|
||||||
|
$response->headers->set('Content-Length', $length);
|
||||||
$response->prepare($request);
|
$response->prepare($request);
|
||||||
|
|
||||||
$this->assertEquals('', $response->getContent());
|
$this->assertEquals('', $response->getContent());
|
||||||
|
$this->assertEquals($length, $response->headers->get('Content-Length'), 'Content-Length should be as if it was GET; see RFC2616 14.13');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrepareRemovesContentForInformationalResponse()
|
public function testPrepareRemovesContentForInformationalResponse()
|
||||||
|
Reference in New Issue
Block a user