Skip to content

Commit

Permalink
minor symfony#16561 Add information to sub request (DamienDeSousa)
Browse files Browse the repository at this point in the history
This PR was submitted for the 4.4 branch but it was squashed and merged into the 5.4 branch instead.

Discussion
----------

Add information to sub request

Adding some information about _format attribute default value because I spend some times to understand why this wasn't working for me. Now I know why it was not working, _format value was html by default and I get no error message. So I just share with orther developers this little update to avoid them spending the same time.

Thank you, have a nice day :)

Commits
-------

4421eaa Add information to sub request
  • Loading branch information
javiereguiluz committed Jan 18, 2024
2 parents 0b3b567 + 4421eaa commit 6bab099
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/http_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,11 @@ look like this::

.. _http-kernel-resource-locator:

Also, note that by default, if the ``_format`` attribute is not set in your request, the value will be ``html``.
So, if your sub request returns something else than ``html`` (like json for instance) you can set it by setting the ``_format`` attribute on the request::

$request->attributes->set('_format', 'json');

Locating Resources
------------------

Expand Down

0 comments on commit 6bab099

Please sign in to comment.