Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a61c137

Browse filesBrowse files
committed
[HttpFoundation] Add doc for Request::getContent() method
1 parent fc0aa8b commit a61c137
Copy full SHA for a61c137

File tree

Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed

‎components/http_foundation/introduction.rst

Copy file name to clipboardExpand all lines: components/http_foundation/introduction.rst
+10-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.