[HttpFoundation] fixed StreamedResponse with HEAD as a method (closes #4502)
This commit is contained in:
parent
6efc00d39d
commit
0f67ca88c1
@ -206,7 +206,7 @@ class Response
|
|||||||
$headers = $this->headers;
|
$headers = $this->headers;
|
||||||
|
|
||||||
if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) {
|
if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) {
|
||||||
$this->setContent('');
|
$this->setContent(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content-type based on the Request
|
// Content-type based on the Request
|
||||||
@ -234,7 +234,7 @@ class Response
|
|||||||
if ('HEAD' === $request->getMethod()) {
|
if ('HEAD' === $request->getMethod()) {
|
||||||
// cf. RFC2616 14.13
|
// cf. RFC2616 14.13
|
||||||
$length = $headers->get('Content-Length');
|
$length = $headers->get('Content-Length');
|
||||||
$this->setContent('');
|
$this->setContent(null);
|
||||||
if ($length) {
|
if ($length) {
|
||||||
$headers->set('Content-Length', $length);
|
$headers->set('Content-Length', $length);
|
||||||
}
|
}
|
||||||
|
@ -581,7 +581,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
private function restoreResponseBody(Request $request, Response $response)
|
private function restoreResponseBody(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
if ('HEAD' === $request->getMethod() || 304 === $response->getStatusCode()) {
|
if ('HEAD' === $request->getMethod() || 304 === $response->getStatusCode()) {
|
||||||
$response->setContent('');
|
$response->setContent(null);
|
||||||
$response->headers->remove('X-Body-Eval');
|
$response->headers->remove('X-Body-Eval');
|
||||||
$response->headers->remove('X-Body-File');
|
$response->headers->remove('X-Body-File');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user