Skip to content

Commit 0f67ca8

Browse files
committed
[HttpFoundation] fixed StreamedResponse with HEAD as a method (closes symfony#4502)
1 parent 6efc00d commit 0f67ca8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function prepare(Request $request)
206206
$headers = $this->headers;
207207

208208
if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) {
209-
$this->setContent('');
209+
$this->setContent(null);
210210
}
211211

212212
// Content-type based on the Request
@@ -234,7 +234,7 @@ public function prepare(Request $request)
234234
if ('HEAD' === $request->getMethod()) {
235235
// cf. RFC2616 14.13
236236
$length = $headers->get('Content-Length');
237-
$this->setContent('');
237+
$this->setContent(null);
238238
if ($length) {
239239
$headers->set('Content-Length', $length);
240240
}

src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ protected function store(Request $request, Response $response)
581581
private function restoreResponseBody(Request $request, Response $response)
582582
{
583583
if ('HEAD' === $request->getMethod() || 304 === $response->getStatusCode()) {
584-
$response->setContent('');
584+
$response->setContent(null);
585585
$response->headers->remove('X-Body-Eval');
586586
$response->headers->remove('X-Body-File');
587587

0 commit comments

Comments
 (0)