You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was merged into the 2.7 branch.
Discussion
----------
Update events.rst
What I have done here is just a complete explanation what is going on during setting response status code. Sentence `setting the status on the response won't work` is not true because if we pass "proper status code" it will be passed to final response without further checks - condition: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpKernel.php#L248. So for example If I do something like this
``` php
// ...
$exception = $event->getException();
$response = new Response();
// setup the Response object based on the caught exception
$event->setResponse($response);
$event->setStatusCode(400);
```
Finally 400 status code will be passed to response!
In my opinion current documentation is incorrect and as a developer I would like to have valid information. Maybe what I wrote is too precise maybe a reference to code would be a better option ? Thanks a lot.
Commits
-------
4db1863 Update events.rst
0 commit comments