Skip to content

Commit 3f4b319

Browse files
committed
feature #3610 [HttpFoundation] Add doc for Request::getContent() method (bicpi)
This PR was merged into the 2.3 branch. Discussion ---------- [HttpFoundation] Add doc for Request::getContent() method | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | #3609 Commits ------- a61c137 [HttpFoundation] Add doc for Request::getContent() method
2 parents 56bc266 + a61c137 commit 3f4b319

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/http_foundation/introduction.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,22 @@ argument::
168168

169169
.. _component-foundation-attributes:
170170

171-
Finally, you can also store additional data in the request,
172-
thanks to the public ``attributes`` property, which is also an instance of
171+
Thanks to the public ``attributes`` property, you can store additional data
172+
in the request, which is also an instance of
173173
:class:`Symfony\\Component\\HttpFoundation\\ParameterBag`. This is mostly used
174174
to attach information that belongs to the Request and that needs to be
175175
accessed from many different points in your application. For information
176176
on how this is used in the Symfony2 framework, see
177177
:ref:`the Symfony2 book <book-fundamentals-attributes>`.
178178

179+
Finally, the raw data sent with the request body can be accessed using
180+
:method:`Symfony\\Component\\HttpFoundation\\Request::getContent()`::
181+
182+
$content = $request->getContent();
183+
184+
For instance, this may be useful to process a JSON string sent to the
185+
application by a remote service using the HTTP POST method.
186+
179187
Identifying a Request
180188
~~~~~~~~~~~~~~~~~~~~~
181189

0 commit comments

Comments
 (0)