[HttpFoundation] fixed StreamedResponse with HEAD as a method (closes #4502)

This commit is contained in:
Fabien Potencier 2012-06-13 16:20:50 +02:00
parent 6efc00d39d
commit 0f67ca88c1
2 changed files with 3 additions and 3 deletions

View File

@ -206,7 +206,7 @@ class Response
$headers = $this->headers;
if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) {
$this->setContent('');
$this->setContent(null);
}
// Content-type based on the Request
@ -234,7 +234,7 @@ class Response
if ('HEAD' === $request->getMethod()) {
// cf. RFC2616 14.13
$length = $headers->get('Content-Length');
$this->setContent('');
$this->setContent(null);
if ($length) {
$headers->set('Content-Length', $length);
}

View File

@ -581,7 +581,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
private function restoreResponseBody(Request $request, Response $response)
{
if ('HEAD' === $request->getMethod() || 304 === $response->getStatusCode()) {
$response->setContent('');
$response->setContent(null);
$response->headers->remove('X-Body-Eval');
$response->headers->remove('X-Body-File');