{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/plug/issues/197","labels_url":"https://api.github.com/repos/elixir-lang/plug/issues/197/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/plug/issues/197/comments","events_url":"https://api.github.com/repos/elixir-lang/plug/issues/197/events","html_url":"https://github.com/elixir-lang/plug/issues/197","id":59328278,"number":197,"title":"Plug.Conn.*_header is not case-insensitive","user":{"login":"hahuang65","id":280972,"avatar_url":"https://avatars.githubusercontent.com/u/280972?v=3","gravatar_id":"","url":"https://api.github.com/users/hahuang65","html_url":"https://github.com/hahuang65","followers_url":"https://api.github.com/users/hahuang65/followers","following_url":"https://api.github.com/users/hahuang65/following{/other_user}","gists_url":"https://api.github.com/users/hahuang65/gists{/gist_id}","starred_url":"https://api.github.com/users/hahuang65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hahuang65/subscriptions","organizations_url":"https://api.github.com/users/hahuang65/orgs","repos_url":"https://api.github.com/users/hahuang65/repos","events_url":"https://api.github.com/users/hahuang65/events{/privacy}","received_events_url":"https://api.github.com/users/hahuang65/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-28T06:24:10Z","updated_at":"2015-02-28T07:54:52Z","closed_at":null,"body":"Functions like get_req_header/2, get_resp_header/2, update_resp_header/3 are not case-insensitive.\r\n\r\nAccording to the [HTTP spec](http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)\r\n\r\nHeader fields should be case-insensitive.\r\n\r\nI ran into this while trying to get the header for X-AUTH-TOKEN and HTTPoison downcased it for me, and it wouldn't retrieve in Plug.\r\n\r\nWould you be open to accepting a pull request for the get_*_headers?\r\n\r\nThe PR would look basically like:\r\n\r\n```elixir\r\ndef get_req_header(%Conn{req_headers: headers}, key) when is_binary(key) do\r\n  for {k, v} <- headers, String.upcase(k) == key, do: v\r\n  # Or String.downcase...\r\nend\r\n```\r\n\r\nThe ones where we write/update headers, we might want to address separately as that may require a little more thought on how we'd want to do it."},"comment":{"url":"https://api.github.com/repos/elixir-lang/plug/issues/comments/76516098","html_url":"https://github.com/elixir-lang/plug/issues/197#issuecomment-76516098","issue_url":"https://api.github.com/repos/elixir-lang/plug/issues/197","id":76516098,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2015-02-28T07:54:52Z","updated_at":"2015-02-28T07:54:52Z","body":"We expect the server adapter to lower case all fields. The developer just\nneed to follow this convention of using lower case names too. It is\ndocumented in Plug.Conn.\n\n-- \n\n\n*José Valim*\nwww.plataformatec.com.br\nSkype: jv.ptec\nFounder and Lead Developer\n"}}