This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/HttpKernel
Fabien Potencier 7b933ababf feature #22228 [HttpKernel] minor: add ability to construct with headers on http exceptions (gsdevme)
This PR was merged into the 4.0-dev branch.

Discussion
----------

[HttpKernel] minor: add ability to construct with headers on http exceptions

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This adds the ability to set the headers for the exception within the constructor.

With alot of the following exceptions its sometimes very useful to be able to set the headers. For example with a reverse proxy cache (Varnish) if you want to match the `Retry-After` with a Varnish cache header to protect the backend.

I see that `setHeaders()` did get added 6a1080f899 but that means the exception needs to be assigned to a variable and set and then thrown, it also doesn't merge with the existing header set in some of the constructors.

~~I've chosen to `array_merge()` where key/values~~ were being set within the constructor as I think this is the most useful and 'correct' whereas `setHeaders` is explicit that its setting not amending or adding to.

Commits
-------

612fb59b32 [HttpKernel] minor: add ability to construct with headers on http exceptions
2017-10-08 16:42:21 -07:00
..
Bundle [HttpKernel] removed bundle inheritance 2017-09-26 16:00:30 -07:00
CacheClearer Merge branch '3.4' 2017-09-29 11:39:35 +02:00
CacheWarmer doc fixes 2017-09-29 11:41:38 +02:00
Config Merge branch '3.4' 2017-10-02 08:59:24 +02:00
Controller Merge branch '3.4' 2017-10-02 08:59:24 +02:00
ControllerMetadata Remove HHVM support (second edition) 2017-07-03 10:26:05 +03:00
DataCollector Merge branch '3.4' 2017-10-05 17:11:25 +02:00
Debug Merge branch '3.2' into 3.3 2017-06-02 11:51:43 +02:00
DependencyInjection Merge branch '3.4' 2017-10-02 08:59:24 +02:00
Event [HttpKernel] Deprecate X-Status-Code for better alternative 2017-02-23 21:30:09 +00:00
EventListener Show welcome message if no routing configuration could be found 2017-10-02 19:25:29 -04:00
Exception feature #22228 [HttpKernel] minor: add ability to construct with headers on http exceptions (gsdevme) 2017-10-08 16:42:21 -07:00
Fragment Merge branch '3.4' 2017-10-02 08:59:24 +02:00
HttpCache Merge branch '2.8' into 3.3 2017-10-02 08:42:24 +02:00
Log Reset profiler. 2017-10-05 12:20:28 +02:00
Profiler Reset profiler. 2017-10-05 12:20:28 +02:00
Resources Show welcome message if no routing configuration could be found 2017-10-02 19:25:29 -04:00
Tests feature #22228 [HttpKernel] minor: add ability to construct with headers on http exceptions (gsdevme) 2017-10-08 16:42:21 -07:00
.gitignore Fix gitignore 2014-03-04 18:06:29 +01:00
CHANGELOG.md Merge branch '3.4' 2017-10-05 17:11:25 +02:00
Client.php Merge branch '3.3' into 3.4 2017-10-02 08:49:52 +02:00
composer.json Merge branch '3.4' 2017-10-03 15:36:01 +02:00
HttpKernel.php removed useless PHPDoc 2017-09-30 07:00:23 -07:00
HttpKernelInterface.php remove api tags from code 2015-09-28 19:11:22 +02:00
Kernel.php Merge branch '3.4' 2017-10-02 08:59:24 +02:00
KernelEvents.php Fix event annotation for arguments resolving event 2016-10-04 15:51:31 -07:00
KernelInterface.php [HttpKernel] removed bundle inheritance 2017-09-26 16:00:30 -07:00
LICENSE updated LICENSE year 2017-01-02 12:30:00 -08:00
phpunit.xml.dist fail when detecting risky tests 2017-04-12 09:39:27 +02:00
README.md Updated all the README files 2016-03-04 08:12:06 +01:00
RebootableInterface.php [HttpKernel][FrameworkBundle] Add RebootableInterface, fix and un-deprecate cache:clear with warmup 2017-08-18 13:51:16 +02:00
TerminableInterface.php remove api tags from code 2015-09-28 19:11:22 +02:00
UriSigner.php Merge branch '2.8' into 3.3 2017-10-02 08:42:24 +02:00

HttpKernel Component

The HttpKernel component provides a structured process for converting a Request into a Response by making use of the EventDispatcher component. It's flexible enough to create a full-stack framework (Symfony), a micro-framework (Silex) or an advanced CMS system (Drupal).

Resources