Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bab099

Browse files
committed
minor #16561 Add information to sub request (DamienDeSousa)
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
2 parents 0b3b567 + 4421eaa commit 6bab099

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/http_kernel.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,11 @@ look like this::
711711

712712
.. _http-kernel-resource-locator:
713713

714+
Also, note that by default, if the ``_format`` attribute is not set in your request, the value will be ``html``.
715+
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::
716+
717+
$request->attributes->set('_format', 'json');
718+
714719
Locating Resources
715720
------------------
716721

0 commit comments

Comments
 (0)