{"action":"created","issue":{"url":"https://api.github.com/repos/kemalcr/kemal/issues/377","repository_url":"https://api.github.com/repos/kemalcr/kemal","labels_url":"https://api.github.com/repos/kemalcr/kemal/issues/377/labels{/name}","comments_url":"https://api.github.com/repos/kemalcr/kemal/issues/377/comments","events_url":"https://api.github.com/repos/kemalcr/kemal/issues/377/events","html_url":"https://github.com/kemalcr/kemal/pull/377","id":243242236,"number":377,"title":"Unify Context params access","user":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars4.githubusercontent.com/u/990485?v=4","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-07-16T14:09:54Z","updated_at":"2017-07-16T14:52:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kemalcr/kemal/pulls/377","html_url":"https://github.com/kemalcr/kemal/pull/377","diff_url":"https://github.com/kemalcr/kemal/pull/377.diff","patch_url":"https://github.com/kemalcr/kemal/pull/377.patch"},"body":"This unifies accessing `HTTP::Server::Context` params.\r\n\r\nBefore\r\n\r\n```crystal\r\nenv.params.url[\"url_param\"]\r\nenv.params.query[\"query_param\"]\r\nenv.params.body[\"body_param\"]\r\nenv.params.json[\"json_param\"]\r\n```\r\n\r\nAfter\r\n\r\n```crystal\r\nenv.params[\"url_param\"]\r\nenv.params[\"query_param\"]\r\nenv.params[\"body_param\"]\r\nenv.params[\"json_param\"]\r\n```\r\n\r\nHowever this PR comes with a caveat of not being able to access a key as an Array. Consider the following spec. This won't work as of now\r\n\r\n```\r\nit \"parses multiple values for query params\" do\r\n    request = HTTP::Request.new(\"POST\", \"/?hasan=cemal&hasan=lamec\")\r\n    query_params = Kemal::ParamParser.new(request).params\r\n    query_params.fetch_all(\"hasan\").should eq [\"cemal\", \"lamec\"]\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/kemalcr/kemal/issues/comments/315614344","html_url":"https://github.com/kemalcr/kemal/pull/377#issuecomment-315614344","issue_url":"https://api.github.com/repos/kemalcr/kemal/issues/377","id":315614344,"user":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars4.githubusercontent.com/u/990485?v=4","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"created_at":"2017-07-16T14:52:03Z","updated_at":"2017-07-16T14:52:03Z","body":"@straight-shoota With this implementation it'd be impossible to namespace colliding parameters because it's all gathered in a single `params` hash."}}
{"actor":{"display_login":"sdogruyol"}}