{"action":"created","issue":{"url":"https://api.github.com/repos/contao/core-bundle/issues/339","labels_url":"https://api.github.com/repos/contao/core-bundle/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/contao/core-bundle/issues/339/comments","events_url":"https://api.github.com/repos/contao/core-bundle/issues/339/events","html_url":"https://github.com/contao/core-bundle/pull/339","id":104077336,"number":339,"title":"[RTM] Added a fully unit tested MergeHttpHeadersListener","user":{"login":"Toflar","id":481937,"avatar_url":"https://avatars.githubusercontent.com/u/481937?v=3","gravatar_id":"","url":"https://api.github.com/users/Toflar","html_url":"https://github.com/Toflar","followers_url":"https://api.github.com/users/Toflar/followers","following_url":"https://api.github.com/users/Toflar/following{/other_user}","gists_url":"https://api.github.com/users/Toflar/gists{/gist_id}","starred_url":"https://api.github.com/users/Toflar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toflar/subscriptions","organizations_url":"https://api.github.com/users/Toflar/orgs","repos_url":"https://api.github.com/users/Toflar/repos","events_url":"https://api.github.com/users/Toflar/events{/privacy}","received_events_url":"https://api.github.com/users/Toflar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/contao/core-bundle/labels/feature","name":"feature","color":"3364b7"}],"state":"open","locked":false,"assignee":{"login":"Toflar","id":481937,"avatar_url":"https://avatars.githubusercontent.com/u/481937?v=3","gravatar_id":"","url":"https://api.github.com/users/Toflar","html_url":"https://github.com/Toflar","followers_url":"https://api.github.com/users/Toflar/followers","following_url":"https://api.github.com/users/Toflar/following{/other_user}","gists_url":"https://api.github.com/users/Toflar/gists{/gist_id}","starred_url":"https://api.github.com/users/Toflar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toflar/subscriptions","organizations_url":"https://api.github.com/users/Toflar/orgs","repos_url":"https://api.github.com/users/Toflar/repos","events_url":"https://api.github.com/users/Toflar/events{/privacy}","received_events_url":"https://api.github.com/users/Toflar/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/contao/core-bundle/milestones/4","html_url":"https://github.com/contao/core-bundle/milestones/4.1.0","labels_url":"https://api.github.com/repos/contao/core-bundle/milestones/4/labels","id":1108381,"number":4,"title":"4.1.0","description":"Contao 4.1.0 (minor release)","creator":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":4,"state":"open","created_at":"2015-05-13T11:06:24Z","updated_at":"2015-10-14T10:42:31Z","due_on":null,"closed_at":null},"comments":23,"created_at":"2015-08-31T15:37:22Z","updated_at":"2015-10-15T09:14:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/contao/core-bundle/pulls/339","html_url":"https://github.com/contao/core-bundle/pull/339","diff_url":"https://github.com/contao/core-bundle/pull/339.diff","patch_url":"https://github.com/contao/core-bundle/pull/339.patch"},"body":"This is a follow up to https://github.com/contao/core-bundle/pull/331. We still have a lot of \"legacy\" code that cannot properly send HTTP headers. The way to go currently is still using `header()`. However, those ones are not respected in a lot of Symfony Bundles that listen on `kernel.response` and read the `Response` object for headers and do more stuff accordingly. This PR provides a listener that merges the sent HTTP headers into the SF response object unless they were already present (so it's not possible to overwrite the ones in the response).\r\n\r\nRFC: \r\n\r\n* [x] `listener.yml` and config is obviously still missing.\r\n* [x] Is it correct not to replace already existing headers in the response object?\r\n* [x] What about the status code? I cannot really use `http_response_code()` because how do I know whether the one in the `Response` object is correct or the one set using `header()`?"},"comment":{"url":"https://api.github.com/repos/contao/core-bundle/issues/comments/148327131","html_url":"https://github.com/contao/core-bundle/pull/339#issuecomment-148327131","issue_url":"https://api.github.com/repos/contao/core-bundle/issues/339","id":148327131,"user":{"login":"Toflar","id":481937,"avatar_url":"https://avatars.githubusercontent.com/u/481937?v=3","gravatar_id":"","url":"https://api.github.com/users/Toflar","html_url":"https://github.com/Toflar","followers_url":"https://api.github.com/users/Toflar/followers","following_url":"https://api.github.com/users/Toflar/following{/other_user}","gists_url":"https://api.github.com/users/Toflar/gists{/gist_id}","starred_url":"https://api.github.com/users/Toflar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toflar/subscriptions","organizations_url":"https://api.github.com/users/Toflar/orgs","repos_url":"https://api.github.com/users/Toflar/repos","events_url":"https://api.github.com/users/Toflar/events{/privacy}","received_events_url":"https://api.github.com/users/Toflar/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T09:14:51Z","updated_at":"2015-10-15T09:14:51Z","body":"> How about a method in the event listener to disable it instead of defining the routes? Then your custom controller could simply get the service and make sure the headers are \"ignored\" if it really ever is a problem.\r\n\r\nI don't like this approach. I think that's wrong."}}