merged branch kriswallsmith/head-streamed-response-err (PR #4502)

Commits
-------

280fc05 failing test for HEAD StreamedResponse requests

Discussion
----------

[WIP] failing test for HEAD StreamedResponse requests

An exception is thrown if you prepare a StreamedResponse with a HEAD request. I'm not sure what the right fix is…

---------------------------------------------------------------------------

by kriswallsmith at 2012-06-06T15:51:04Z

The Travis build is here: http://travis-ci.org/#!/symfony/symfony/builds/1543352

---------------------------------------------------------------------------

by sstok at 2012-06-08T11:07:31Z

Well a HEAD can't/shouldn't be streamed as it doesn't contain a body so what is the real problem here?

---------------------------------------------------------------------------

by kriswallsmith at 2012-06-08T16:14:18Z

@sstok the response is prepared by the ResponseListener regardless of request method

---------------------------------------------------------------------------

by adrienbrault at 2012-06-08T19:41:27Z

Shouldn't the test at least assert something ?
This commit is contained in:
Fabien Potencier 2012-06-13 16:17:27 +02:00
commit 6efc00d39d

View File

@ -50,6 +50,14 @@ class StreamedResponseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('no-cache, private', $response->headers->get('Cache-Control'));
}
public function testPrepareWithHeadRequest()
{
$response = new StreamedResponse(function () { echo 'foo'; });
$request = Request::create('/', 'HEAD');
$response->prepare($request);
}
public function testSendContent()
{
$called = 0;