1

i am new on Simfony and I am trying to set a Content-Length header in my response.

This is my controller action:

public function homepageAction() {

   $content= $this>renderView('AcmeBlogBundle:Pages/homepage:homepage_content.html.twig');

   $response= new Response();

   $response->setContent($content);

   $response->headers->set('Content-Length: 1736233495'); // value added manually

   return $response;

} // homepage

i obtain an error 500 internal server error.

Domenico
  • 82
  • 1
  • 13

2 Answers2

3

Did you try to $response->headers->set('Content-Length', 1736233495); ?

EDIT : Documentation

AlixB
  • 1,208
  • 2
  • 10
  • 19
0

Maybe the "-" missing in the "$this>renderView" part ?

rgazelot
  • 518
  • 6
  • 14