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

Skip to content

[HttpKernel] added a setter for the headers property in the HttpException #17111

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

smatyas
Copy link
Contributor

@smatyas smatyas commented Dec 22, 2015

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR symfony/symfony-docs#6076

Added this setter, because it's now impossible to use those handy, meaningful, already implemented exceptions (like NotFound...) if one wants to set some custom headers. This PR solves this problem.
It's a backward compatible solution in this way, but maybe it would be better if the HttpExceptionInterface would contain the setHeaders function as well. Of course this would be a BC break, that's why it is missing now.

TODO:

  • submit changes to the documentation

@smatyas smatyas changed the title [WIP][HttpKernel] added a setter for the headers property in the HttpException [HttpKernel] added a setter for the headers property in the HttpException Dec 25, 2015
@smatyas smatyas force-pushed the http_exceptions_headers branch 2 times, most recently from 529502d to 540c321 Compare December 25, 2015 17:27
@nicolas-grekas
Copy link
Member

I'm not sure it makes sense to tests all children classes of HttpException. I'd say only HttpExceptionTest is required here. If you really think it's worth, then I suggest using a data provider instead of duplicating the test cases for every type.

@smatyas smatyas force-pushed the http_exceptions_headers branch from 540c321 to c86ace0 Compare December 28, 2015 18:39
@smatyas
Copy link
Contributor Author

smatyas commented Dec 28, 2015

I've reorganized the test classes to use the same data provider, and rebased my changes to the latest 2.8

MethodNotAllowedHttpException, ServiceUnavailableHttpException, TooManyRequestsHttpException and UnauthorizedHttpException do set default headers in certain circumstances, that's why I started writing tests for all classes. Also I think it's better to have at least these tests on these classes than nothing.

@fabpot
Copy link
Member

fabpot commented Jan 25, 2016

Thank you @smatyas.

@fabpot fabpot closed this in 0b2948f Jan 25, 2016
xabbuh added a commit to symfony/symfony-docs that referenced this pull request Feb 7, 2016
…thod (smatyas)

This PR was submitted for the 2.8 branch but it was merged into the master branch instead (closes #6076).

Discussion
----------

added a sentence about the HttpException::setHeaders method

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes symfony/symfony#17111
| Applies to    | 2.8
| Fixed tickets |

This PR is a doc. change related to the linked symfony PR.

Commits
-------

a5113cf added a sentence about the HttpException::setHeaders method
@fabpot fabpot mentioned this pull request May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants