@@ -762,12 +762,6 @@ headers and content that's sent back to the client::
762762 $response = new Response('<style> ... </style>');
763763 $response->headers->set('Content-Type', 'text/css');
764764
765- .. seealso ::
766-
767- Now that you know the basics you can continue your research on Symfony
768- ``Request `` and ``Response `` object in the
769- :ref: `HttpFoundation component documentation <component-http-foundation-request >`.
770-
771765There are also special classes to make certain kinds of responses easier:
772766
773767* For JSON, there is :class: `Symfony\\ Component\\ HttpFoundation\\ JsonResponse `.
@@ -791,14 +785,17 @@ a ``JsonResponse()`` and encodes the given contents automatically::
791785 public function indexAction()
792786 {
793787 // returns '{"username":"jane.doe"}' and sets the proper Content-Type header
794- $data = array('username' => 'jane.doe');
795- return $this->json($data);
788+ return $this->json(array('username' => 'jane.doe'));
789+
790+ // the shortcut defines three optional arguments
791+ // return $this->json($data, $status = 200, $headers = array(), $context = array());
796792 }
797793
798- The only required argument is the data to be sent, but ``json() `` defines three
799- more optional arguments::
794+ .. seealso ::
800795
801- $this->json($data, $status = 200, $headers = array(), $context = array());
796+ Now that you know the basics you can continue your research on Symfony
797+ ``Request `` and ``Response `` object in the
798+ :ref: `HttpFoundation component documentation <component-http-foundation-request >`.
802799
803800Creating Static Pages
804801---------------------
0 commit comments