Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Update docs for setting custom response code in exception handler#6948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Update docs for setting custom response code in exception handler#6948
Uh oh!
There was an error while loading.Please reload this page.
Conversation
1d59c3c toc413297Comparereference/events.rst Outdated
| ); | ||
| response alone won't work. If you want to overwrite the status code | ||
| (which you should not without a good reason), call | ||
| ``GetResponseForExceptionEvent::setAllowSuccessfulResponse(true)`` and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
should besetAllowCustomResponseCode as the method has been renamed.
c413297 tod825c4aCompare…ative (jameshalsall)This PR was merged into the 3.3-dev branch.Discussion----------[HttpKernel] Deprecate X-Status-Code for better alternative| Q | A || --- | --- || Branch? | master || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | yes || Tests pass? | yes || Fixed tickets |#12343 || License | MIT || Doc PR |symfony/symfony-docs#6948 |This marks the X-Status-Code header method of setting a custom response statuscode in exception listeners for a better alternative. There is now a new methodon the `GetResponseForExceptionEvent` that allows successful status codes inthe response sent to the client.The old method of setting the X-Status-Code header will now throw a deprecation warning.Instead, in your exception listener you simply call `GetResponseForExceptionEvent::allowCustomResponseCode()` which will tell the Kernel not to override the status code of the event's response object.Currenty the `X-Status-Code` header will still be removed, so as not to change the existing behaviour, but this is something we can remove in 4.0.TODO:- [x] Replace usage of X-Status-Code in `FormAuthenticationEntryPoint`- [x] Open Silex issue- [x] Rename method on the response- [x] Ensure correct response code is set in `AuthenticationEntryPointInterface` implementations- [x] Ensure the exception listeners are marking `GetResponseForExceptionEvent` as allowing a custom response code- [x] In the Security component we should only use the new method of setting a custom response code if it is available, and fall back to the `X-Status-Code` methodCommits-------cc0ef28 [HttpKernel] Deprecate X-Status-Code for better alternative
…ative (jameshalsall)This PR was merged into the 3.3-dev branch.Discussion----------[HttpKernel] Deprecate X-Status-Code for better alternative| Q | A || --- | --- || Branch? | master || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | yes || Tests pass? | yes || Fixed tickets | #12343 || License | MIT || Doc PR |symfony/symfony-docs#6948 |This marks the X-Status-Code header method of setting a custom response statuscode in exception listeners for a better alternative. There is now a new methodon the `GetResponseForExceptionEvent` that allows successful status codes inthe response sent to the client.The old method of setting the X-Status-Code header will now throw a deprecation warning.Instead, in your exception listener you simply call `GetResponseForExceptionEvent::allowCustomResponseCode()` which will tell the Kernel not to override the status code of the event's response object.Currenty the `X-Status-Code` header will still be removed, so as not to change the existing behaviour, but this is something we can remove in 4.0.TODO:- [x] Replace usage of X-Status-Code in `FormAuthenticationEntryPoint`- [x] Open Silex issue- [x] Rename method on the response- [x] Ensure correct response code is set in `AuthenticationEntryPointInterface` implementations- [x] Ensure the exception listeners are marking `GetResponseForExceptionEvent` as allowing a custom response code- [x] In the Security component we should only use the new method of setting a custom response code if it is available, and fall back to the `X-Status-Code` methodCommits-------cc0ef28 [HttpKernel] Deprecate X-Status-Code for better alternative
…ative (jameshalsall)This PR was merged into the 3.3-dev branch.Discussion----------[HttpKernel] Deprecate X-Status-Code for better alternative| Q | A || --- | --- || Branch? | master || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | yes || Tests pass? | yes || Fixed tickets | #12343 || License | MIT || Doc PR |symfony/symfony-docs#6948 |This marks the X-Status-Code header method of setting a custom response statuscode in exception listeners for a better alternative. There is now a new methodon the `GetResponseForExceptionEvent` that allows successful status codes inthe response sent to the client.The old method of setting the X-Status-Code header will now throw a deprecation warning.Instead, in your exception listener you simply call `GetResponseForExceptionEvent::allowCustomResponseCode()` which will tell the Kernel not to override the status code of the event's response object.Currenty the `X-Status-Code` header will still be removed, so as not to change the existing behaviour, but this is something we can remove in 4.0.TODO:- [x] Replace usage of X-Status-Code in `FormAuthenticationEntryPoint`- [x] Open Silex issue- [x] Rename method on the response- [x] Ensure correct response code is set in `AuthenticationEntryPointInterface` implementations- [x] Ensure the exception listeners are marking `GetResponseForExceptionEvent` as allowing a custom response code- [x] In the Security component we should only use the new method of setting a custom response code if it is available, and fall back to the `X-Status-Code` methodCommits-------cc0ef282cd [HttpKernel] Deprecate X-Status-Code for better alternative
…ative (jameshalsall)This PR was merged into the 3.3-dev branch.Discussion----------[HttpKernel] Deprecate X-Status-Code for better alternative| Q | A || --- | --- || Branch? | master || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | yes || Tests pass? | yes || Fixed tickets | #12343 || License | MIT || Doc PR |symfony/symfony-docs#6948 |This marks the X-Status-Code header method of setting a custom response statuscode in exception listeners for a better alternative. There is now a new methodon the `GetResponseForExceptionEvent` that allows successful status codes inthe response sent to the client.The old method of setting the X-Status-Code header will now throw a deprecation warning.Instead, in your exception listener you simply call `GetResponseForExceptionEvent::allowCustomResponseCode()` which will tell the Kernel not to override the status code of the event's response object.Currenty the `X-Status-Code` header will still be removed, so as not to change the existing behaviour, but this is something we can remove in 4.0.TODO:- [x] Replace usage of X-Status-Code in `FormAuthenticationEntryPoint`- [x] Open Silex issue- [x] Rename method on the response- [x] Ensure correct response code is set in `AuthenticationEntryPointInterface` implementations- [x] Ensure the exception listeners are marking `GetResponseForExceptionEvent` as allowing a custom response code- [x] In the Security component we should only use the new method of setting a custom response code if it is available, and fall back to the `X-Status-Code` methodCommits-------cc0ef282cd [HttpKernel] Deprecate X-Status-Code for better alternative
xabbuh commentedMar 1, 2017
The code PR was merged. @jameshalsall Thank you for the contribution. Can you fix the conflicts here? |
jameshalsall commentedMar 8, 2017
@xabbuh I will sort this out this week :) |
HeahDude commentedJul 29, 2017
@jameshalsall Will you have time to finish this PR or do you want we to take care of it? Thanks! |
javiereguiluz commentedJan 9, 2018
Thanks James. |
… handler (jameshalsall)This PR was submitted for the master branch but it was merged into the 3.3 branch instead (closes#6948).Discussion----------Update docs for setting custom response code in exception handlerDocs update for the changes applied insymfony/symfony#19822Commits-------5f0becf Update docs for setting custom response code in exception handler
Docs update for the changes applied insymfony/symfony#19822