You are here

public function ResponseTest::testPrepareRemovesContentForHeadRequests in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/ResponseTest.php \Symfony\Component\HttpFoundation\Tests\ResponseTest::testPrepareRemovesContentForHeadRequests()

File

vendor/symfony/http-foundation/Tests/ResponseTest.php, line 495

Class

ResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testPrepareRemovesContentForHeadRequests() {
  $response = new Response('foo');
  $request = Request::create('/', 'HEAD');
  $length = 12345;
  $response->headers
    ->set('Content-Length', $length);
  $response
    ->prepare($request);
  $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');
}