Commit bc83735
committed
minor #6857 Update events.rst (tabbi89)
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.rst1 file changed
+16
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 244 | + | |
| 245 | + | |
248 | 246 | | |
249 | 247 | | |
250 | 248 | | |
| |||
254 | 252 | | |
255 | 253 | | |
256 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
257 | 269 | | |
258 | 270 | | |
259 | 271 | | |
| |||
0 commit comments