{"action":"created","issue":{"url":"https://api.github.com/repos/frodsan/tynn/issues/17","labels_url":"https://api.github.com/repos/frodsan/tynn/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/frodsan/tynn/issues/17/comments","events_url":"https://api.github.com/repos/frodsan/tynn/issues/17/events","html_url":"https://github.com/frodsan/tynn/issues/17","id":120165584,"number":17,"title":"Accessing Request Headers","user":{"login":"moonglum","id":95788,"avatar_url":"https://avatars.githubusercontent.com/u/95788?v=3","gravatar_id":"","url":"https://api.github.com/users/moonglum","html_url":"https://github.com/moonglum","followers_url":"https://api.github.com/users/moonglum/followers","following_url":"https://api.github.com/users/moonglum/following{/other_user}","gists_url":"https://api.github.com/users/moonglum/gists{/gist_id}","starred_url":"https://api.github.com/users/moonglum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moonglum/subscriptions","organizations_url":"https://api.github.com/users/moonglum/orgs","repos_url":"https://api.github.com/users/moonglum/repos","events_url":"https://api.github.com/users/moonglum/events{/privacy}","received_events_url":"https://api.github.com/users/moonglum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-12-03T13:01:04Z","updated_at":"2015-12-03T15:57:51Z","closed_at":null,"body":"It seems that neither Rack nor Syro provide an easy/obvious way to access HTTP headers of requests. I consider this a pretty important feature, shall we add it on the Tynn level? I suggest an API like this:\r\n\r\n```ruby\r\nreq.header('Accept-Charset')\r\n```\r\n\r\nFrom my understanding, the way to access the header `Accept` in Rack is the following:\r\n\r\n```ruby\r\nreq.env['HTTP_ACCEPT_CHARSET']\r\n```\r\n\r\nI would go a very simple route by adding the following method to Tynn::Request:\r\n\r\n```ruby\r\ndef header(name)\r\n  env[\"HTTP_#{name.tr('-', '_').upcase}\"]\r\nend\r\n```\r\n\r\nI'm also ok with including this via a plugin, but I vote for including it by default. Headers are a crucial component of HTTP and therefore should be supported in a straightforward way by an HTTP library in my opinion :smile: If you like that, I'll code it and send a PR :smile: "},"comment":{"url":"https://api.github.com/repos/frodsan/tynn/issues/comments/161688182","html_url":"https://github.com/frodsan/tynn/issues/17#issuecomment-161688182","issue_url":"https://api.github.com/repos/frodsan/tynn/issues/17","id":161688182,"user":{"login":"frodsan","id":840464,"avatar_url":"https://avatars.githubusercontent.com/u/840464?v=3","gravatar_id":"","url":"https://api.github.com/users/frodsan","html_url":"https://github.com/frodsan","followers_url":"https://api.github.com/users/frodsan/followers","following_url":"https://api.github.com/users/frodsan/following{/other_user}","gists_url":"https://api.github.com/users/frodsan/gists{/gist_id}","starred_url":"https://api.github.com/users/frodsan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frodsan/subscriptions","organizations_url":"https://api.github.com/users/frodsan/orgs","repos_url":"https://api.github.com/users/frodsan/repos","events_url":"https://api.github.com/users/frodsan/events{/privacy}","received_events_url":"https://api.github.com/users/frodsan/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T15:57:51Z","updated_at":"2015-12-03T15:57:51Z","body":"> I would suggest going with [], fetch and key? for the first version and see if people bring up valid use cases for the other ones.\r\n\r\n:+1: \r\n\r\n> which makes me think that it probably should be part of Syro :confused:\r\n\r\nYou can ask. I'm ok to add it to Tynn::Request if it doesn't get accepted in Syro."}}