{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/16646","labels_url":"https://api.github.com/repos/symfony/symfony/issues/16646/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/16646/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/16646/events","html_url":"https://github.com/symfony/symfony/issues/16646","id":118554987,"number":16646,"title":"Request Accept Header with multiple values returns inconsistent contains() responses","user":{"login":"rupertjeff","id":516384,"avatar_url":"https://avatars.githubusercontent.com/u/516384?v=3","gravatar_id":"","url":"https://api.github.com/users/rupertjeff","html_url":"https://github.com/rupertjeff","followers_url":"https://api.github.com/users/rupertjeff/followers","following_url":"https://api.github.com/users/rupertjeff/following{/other_user}","gists_url":"https://api.github.com/users/rupertjeff/gists{/gist_id}","starred_url":"https://api.github.com/users/rupertjeff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rupertjeff/subscriptions","organizations_url":"https://api.github.com/users/rupertjeff/orgs","repos_url":"https://api.github.com/users/rupertjeff/repos","events_url":"https://api.github.com/users/rupertjeff/events{/privacy}","received_events_url":"https://api.github.com/users/rupertjeff/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/HttpFoundation","name":"HttpFoundation","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-24T08:13:09Z","updated_at":"2015-11-25T17:33:55Z","closed_at":null,"body":"I'm building an API as part of a larger Laravel-based application and I'm trying to work through Content Negotiation as per the JSON API 1.0 specification. I'm using Postman to send a request with the snippet below:\r\n\r\n```http\r\nGET /generic/request HTTP/1.1\r\nContent-Type: application/vnd.api+json\r\nAccept: application/vnd.api+json\r\nAccept: image/png\r\n```\r\n\r\nWhen I try to run `$request->headers->contains('Accept', 'application/vnd.api+json')` I receive `false`.\r\n\r\n`$request->headers->get('Accept')` returns a string `\"application/vnd.api+json, image/png\"`.\r\n\r\nIs this the expected functionality, or should I be doing something else instead? I perused the code, and it looks like `HeaderBag::contains()` runs `in_array()`, but as the `Accept` header is always coming back as a string, there's no exact match.\r\n\r\nThanks! Let me know if more information is needed, or if there's something I'm missing."},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/159682710","html_url":"https://github.com/symfony/symfony/issues/16646#issuecomment-159682710","issue_url":"https://api.github.com/repos/symfony/symfony/issues/16646","id":159682710,"user":{"login":"rupertjeff","id":516384,"avatar_url":"https://avatars.githubusercontent.com/u/516384?v=3","gravatar_id":"","url":"https://api.github.com/users/rupertjeff","html_url":"https://github.com/rupertjeff","followers_url":"https://api.github.com/users/rupertjeff/followers","following_url":"https://api.github.com/users/rupertjeff/following{/other_user}","gists_url":"https://api.github.com/users/rupertjeff/gists{/gist_id}","starred_url":"https://api.github.com/users/rupertjeff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rupertjeff/subscriptions","organizations_url":"https://api.github.com/users/rupertjeff/orgs","repos_url":"https://api.github.com/users/rupertjeff/repos","events_url":"https://api.github.com/users/rupertjeff/events{/privacy}","received_events_url":"https://api.github.com/users/rupertjeff/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T17:33:55Z","updated_at":"2015-11-25T17:33:55Z","body":"Oooh, I like that. Much simpler than what I'm doing. I'll definitely jump back in and play some more here. Thanks!\r\n\r\nMy only sticking issue is that `HeaderBag::contains` uses `in_array` to do a string comparison. It's misleading when you're perusing the code. (I don't know if the documentation specifies this functionality; I'm of the mindset that I should be able to determine what something does by reading the code. That, and I was on an airplane without any WiFi.) Is there something I don't know about `in_array` that makes this method more effective?"}}