Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions reference/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,8 @@ and set a new ``Exception`` object, or do nothing::

.. note::

If you want to overwrite the status code (which you should do not without a good
reason), set the ``X-Status-Code`` header::

$response = new Response(
'Error',
404, // this status code will be ignored
array(
'X-Status-Code' => 200 // this status code will actually be sent to the client
)
);

If you do **not** set the ``X-Status-Code`` header, then Symfony uses the following
logic to determine the status code:
Symfony uses the following logic to determine the HTTP status code of the
response:

* If :method:`Symfony\\Component\\HttpFoundation\\Response::isClientError`,
:method:`Symfony\\Component\\HttpFoundation\\Response::isServerError` or
Expand Down