{"action":"created","comment":{"url":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/comments/45080076","id":45080076,"diff_hunk":"@@ -5,5 +5,7 @@ module JSONAPI\n Mime::Type.register JSONAPI::MEDIA_TYPE, :api_json\n \n ActionDispatch::ParamsParser::DEFAULT_PARSERS[Mime::Type.lookup(JSONAPI::MEDIA_TYPE)] = lambda do |body|\n-  JSON.parse(body)\n+  data = JSON.parse(body)\n+  data = {:_json => data} unless data.is_a?(Hash)","path":"lib/jsonapi/mime_types.rb","position":6,"original_position":6,"commit_id":"795b94caa1cf715b48b5b0897522bbd1b0724902","original_commit_id":"795b94caa1cf715b48b5b0897522bbd1b0724902","user":{"login":"reidab","id":13192,"avatar_url":"https://avatars.githubusercontent.com/u/13192?v=3","gravatar_id":"","url":"https://api.github.com/users/reidab","html_url":"https://github.com/reidab","followers_url":"https://api.github.com/users/reidab/followers","following_url":"https://api.github.com/users/reidab/following{/other_user}","gists_url":"https://api.github.com/users/reidab/gists{/gist_id}","starred_url":"https://api.github.com/users/reidab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidab/subscriptions","organizations_url":"https://api.github.com/users/reidab/orgs","repos_url":"https://api.github.com/users/reidab/repos","events_url":"https://api.github.com/users/reidab/events{/privacy}","received_events_url":"https://api.github.com/users/reidab/received_events","type":"User","site_admin":false},"body":"While the JSON API spec requires the top-level element to be a hash, JSON itself is fine with top-level arrays. I pulled the `{:_json => data}` wrapping from the Rails implementation of this parser, with the expectation that existing code further down the pipeline would raise `ParameterMissing` or something along those lines. I avoided raising the exception here because it wouldn't  have the advantage of being rescued and packed up in a nice JSON response. \r\n\r\nThe root issue is that JSON.parse returns a vanilla `Hash` instead of a `HashWithIndifferentAccess`. This has the side effect of making `request.parameters` also wind up as a vanilla `Hash`, because Rails builds it by merging the query parameters into the result of this parsing.","created_at":"2015-11-17T16:16:16Z","updated_at":"2015-11-17T16:16:16Z","html_url":"https://github.com/cerebris/jsonapi-resources/pull/529#discussion_r45080076","pull_request_url":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529","_links":{"self":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/comments/45080076"},"html":{"href":"https://github.com/cerebris/jsonapi-resources/pull/529#discussion_r45080076"},"pull_request":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529"}}},"pull_request":{"url":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529","id":50810740,"html_url":"https://github.com/cerebris/jsonapi-resources/pull/529","diff_url":"https://github.com/cerebris/jsonapi-resources/pull/529.diff","patch_url":"https://github.com/cerebris/jsonapi-resources/pull/529.patch","issue_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/529","number":529,"state":"open","locked":false,"title":"Make params parsing behave more like Rails","user":{"login":"reidab","id":13192,"avatar_url":"https://avatars.githubusercontent.com/u/13192?v=3","gravatar_id":"","url":"https://api.github.com/users/reidab","html_url":"https://github.com/reidab","followers_url":"https://api.github.com/users/reidab/followers","following_url":"https://api.github.com/users/reidab/following{/other_user}","gists_url":"https://api.github.com/users/reidab/gists{/gist_id}","starred_url":"https://api.github.com/users/reidab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidab/subscriptions","organizations_url":"https://api.github.com/users/reidab/orgs","repos_url":"https://api.github.com/users/reidab/repos","events_url":"https://api.github.com/users/reidab/events{/privacy}","received_events_url":"https://api.github.com/users/reidab/received_events","type":"User","site_admin":false},"body":"Specifically, ensure that the parsed params end up as a HashWithIndifferentAccess instead of a vanilla Hash.","created_at":"2015-11-16T13:38:15Z","updated_at":"2015-11-17T16:16:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ed88255627f4aea8158727f1cc163a039f37ac4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529/commits","review_comments_url":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529/comments","review_comment_url":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/529/comments","statuses_url":"https://api.github.com/repos/cerebris/jsonapi-resources/statuses/795b94caa1cf715b48b5b0897522bbd1b0724902","head":{"label":"reidab:params-parsing-indifferent-access","ref":"params-parsing-indifferent-access","sha":"795b94caa1cf715b48b5b0897522bbd1b0724902","user":{"login":"reidab","id":13192,"avatar_url":"https://avatars.githubusercontent.com/u/13192?v=3","gravatar_id":"","url":"https://api.github.com/users/reidab","html_url":"https://github.com/reidab","followers_url":"https://api.github.com/users/reidab/followers","following_url":"https://api.github.com/users/reidab/following{/other_user}","gists_url":"https://api.github.com/users/reidab/gists{/gist_id}","starred_url":"https://api.github.com/users/reidab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidab/subscriptions","organizations_url":"https://api.github.com/users/reidab/orgs","repos_url":"https://api.github.com/users/reidab/repos","events_url":"https://api.github.com/users/reidab/events{/privacy}","received_events_url":"https://api.github.com/users/reidab/received_events","type":"User","site_admin":false},"repo":{"id":46276556,"name":"jsonapi-resources","full_name":"reidab/jsonapi-resources","owner":{"login":"reidab","id":13192,"avatar_url":"https://avatars.githubusercontent.com/u/13192?v=3","gravatar_id":"","url":"https://api.github.com/users/reidab","html_url":"https://github.com/reidab","followers_url":"https://api.github.com/users/reidab/followers","following_url":"https://api.github.com/users/reidab/following{/other_user}","gists_url":"https://api.github.com/users/reidab/gists{/gist_id}","starred_url":"https://api.github.com/users/reidab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidab/subscriptions","organizations_url":"https://api.github.com/users/reidab/orgs","repos_url":"https://api.github.com/users/reidab/repos","events_url":"https://api.github.com/users/reidab/events{/privacy}","received_events_url":"https://api.github.com/users/reidab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reidab/jsonapi-resources","description":"","fork":true,"url":"https://api.github.com/repos/reidab/jsonapi-resources","forks_url":"https://api.github.com/repos/reidab/jsonapi-resources/forks","keys_url":"https://api.github.com/repos/reidab/jsonapi-resources/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reidab/jsonapi-resources/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reidab/jsonapi-resources/teams","hooks_url":"https://api.github.com/repos/reidab/jsonapi-resources/hooks","issue_events_url":"https://api.github.com/repos/reidab/jsonapi-resources/issues/events{/number}","events_url":"https://api.github.com/repos/reidab/jsonapi-resources/events","assignees_url":"https://api.github.com/repos/reidab/jsonapi-resources/assignees{/user}","branches_url":"https://api.github.com/repos/reidab/jsonapi-resources/branches{/branch}","tags_url":"https://api.github.com/repos/reidab/jsonapi-resources/tags","blobs_url":"https://api.github.com/repos/reidab/jsonapi-resources/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reidab/jsonapi-resources/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reidab/jsonapi-resources/git/refs{/sha}","trees_url":"https://api.github.com/repos/reidab/jsonapi-resources/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reidab/jsonapi-resources/statuses/{sha}","languages_url":"https://api.github.com/repos/reidab/jsonapi-resources/languages","stargazers_url":"https://api.github.com/repos/reidab/jsonapi-resources/stargazers","contributors_url":"https://api.github.com/repos/reidab/jsonapi-resources/contributors","subscribers_url":"https://api.github.com/repos/reidab/jsonapi-resources/subscribers","subscription_url":"https://api.github.com/repos/reidab/jsonapi-resources/subscription","commits_url":"https://api.github.com/repos/reidab/jsonapi-resources/commits{/sha}","git_commits_url":"https://api.github.com/repos/reidab/jsonapi-resources/git/commits{/sha}","comments_url":"https://api.github.com/repos/reidab/jsonapi-resources/comments{/number}","issue_comment_url":"https://api.github.com/repos/reidab/jsonapi-resources/issues/comments{/number}","contents_url":"https://api.github.com/repos/reidab/jsonapi-resources/contents/{+path}","compare_url":"https://api.github.com/repos/reidab/jsonapi-resources/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reidab/jsonapi-resources/merges","archive_url":"https://api.github.com/repos/reidab/jsonapi-resources/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reidab/jsonapi-resources/downloads","issues_url":"https://api.github.com/repos/reidab/jsonapi-resources/issues{/number}","pulls_url":"https://api.github.com/repos/reidab/jsonapi-resources/pulls{/number}","milestones_url":"https://api.github.com/repos/reidab/jsonapi-resources/milestones{/number}","notifications_url":"https://api.github.com/repos/reidab/jsonapi-resources/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reidab/jsonapi-resources/labels{/name}","releases_url":"https://api.github.com/repos/reidab/jsonapi-resources/releases{/id}","created_at":"2015-11-16T13:34:36Z","updated_at":"2015-11-16T13:34:37Z","pushed_at":"2015-11-16T13:40:40Z","git_url":"git://github.com/reidab/jsonapi-resources.git","ssh_url":"git@github.com:reidab/jsonapi-resources.git","clone_url":"https://github.com/reidab/jsonapi-resources.git","svn_url":"https://github.com/reidab/jsonapi-resources","homepage":null,"size":4157,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cerebris:master","ref":"master","sha":"202254acc244254d357a51442462d96886ea20f8","user":{"login":"cerebris","id":326811,"avatar_url":"https://avatars.githubusercontent.com/u/326811?v=3","gravatar_id":"","url":"https://api.github.com/users/cerebris","html_url":"https://github.com/cerebris","followers_url":"https://api.github.com/users/cerebris/followers","following_url":"https://api.github.com/users/cerebris/following{/other_user}","gists_url":"https://api.github.com/users/cerebris/gists{/gist_id}","starred_url":"https://api.github.com/users/cerebris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerebris/subscriptions","organizations_url":"https://api.github.com/users/cerebris/orgs","repos_url":"https://api.github.com/users/cerebris/repos","events_url":"https://api.github.com/users/cerebris/events{/privacy}","received_events_url":"https://api.github.com/users/cerebris/received_events","type":"Organization","site_admin":false},"repo":{"id":18248068,"name":"jsonapi-resources","full_name":"cerebris/jsonapi-resources","owner":{"login":"cerebris","id":326811,"avatar_url":"https://avatars.githubusercontent.com/u/326811?v=3","gravatar_id":"","url":"https://api.github.com/users/cerebris","html_url":"https://github.com/cerebris","followers_url":"https://api.github.com/users/cerebris/followers","following_url":"https://api.github.com/users/cerebris/following{/other_user}","gists_url":"https://api.github.com/users/cerebris/gists{/gist_id}","starred_url":"https://api.github.com/users/cerebris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerebris/subscriptions","organizations_url":"https://api.github.com/users/cerebris/orgs","repos_url":"https://api.github.com/users/cerebris/repos","events_url":"https://api.github.com/users/cerebris/events{/privacy}","received_events_url":"https://api.github.com/users/cerebris/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cerebris/jsonapi-resources","description":"","fork":false,"url":"https://api.github.com/repos/cerebris/jsonapi-resources","forks_url":"https://api.github.com/repos/cerebris/jsonapi-resources/forks","keys_url":"https://api.github.com/repos/cerebris/jsonapi-resources/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cerebris/jsonapi-resources/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cerebris/jsonapi-resources/teams","hooks_url":"https://api.github.com/repos/cerebris/jsonapi-resources/hooks","issue_events_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/events{/number}","events_url":"https://api.github.com/repos/cerebris/jsonapi-resources/events","assignees_url":"https://api.github.com/repos/cerebris/jsonapi-resources/assignees{/user}","branches_url":"https://api.github.com/repos/cerebris/jsonapi-resources/branches{/branch}","tags_url":"https://api.github.com/repos/cerebris/jsonapi-resources/tags","blobs_url":"https://api.github.com/repos/cerebris/jsonapi-resources/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cerebris/jsonapi-resources/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cerebris/jsonapi-resources/git/refs{/sha}","trees_url":"https://api.github.com/repos/cerebris/jsonapi-resources/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cerebris/jsonapi-resources/statuses/{sha}","languages_url":"https://api.github.com/repos/cerebris/jsonapi-resources/languages","stargazers_url":"https://api.github.com/repos/cerebris/jsonapi-resources/stargazers","contributors_url":"https://api.github.com/repos/cerebris/jsonapi-resources/contributors","subscribers_url":"https://api.github.com/repos/cerebris/jsonapi-resources/subscribers","subscription_url":"https://api.github.com/repos/cerebris/jsonapi-resources/subscription","commits_url":"https://api.github.com/repos/cerebris/jsonapi-resources/commits{/sha}","git_commits_url":"https://api.github.com/repos/cerebris/jsonapi-resources/git/commits{/sha}","comments_url":"https://api.github.com/repos/cerebris/jsonapi-resources/comments{/number}","issue_comment_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/comments{/number}","contents_url":"https://api.github.com/repos/cerebris/jsonapi-resources/contents/{+path}","compare_url":"https://api.github.com/repos/cerebris/jsonapi-resources/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cerebris/jsonapi-resources/merges","archive_url":"https://api.github.com/repos/cerebris/jsonapi-resources/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cerebris/jsonapi-resources/downloads","issues_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues{/number}","pulls_url":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls{/number}","milestones_url":"https://api.github.com/repos/cerebris/jsonapi-resources/milestones{/number}","notifications_url":"https://api.github.com/repos/cerebris/jsonapi-resources/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cerebris/jsonapi-resources/labels{/name}","releases_url":"https://api.github.com/repos/cerebris/jsonapi-resources/releases{/id}","created_at":"2014-03-29T18:45:23Z","updated_at":"2015-11-17T02:49:35Z","pushed_at":"2015-11-17T15:52:47Z","git_url":"git://github.com/cerebris/jsonapi-resources.git","ssh_url":"git@github.com:cerebris/jsonapi-resources.git","clone_url":"https://github.com/cerebris/jsonapi-resources.git","svn_url":"https://github.com/cerebris/jsonapi-resources","homepage":null,"size":1949,"stargazers_count":706,"watchers_count":706,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":141,"mirror_url":null,"open_issues_count":118,"forks":141,"open_issues":118,"watchers":706,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529"},"html":{"href":"https://github.com/cerebris/jsonapi-resources/pull/529"},"issue":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/529"},"comments":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/529/comments"},"review_comments":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529/comments"},"review_comment":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/pulls/529/commits"},"statuses":{"href":"https://api.github.com/repos/cerebris/jsonapi-resources/statuses/795b94caa1cf715b48b5b0897522bbd1b0724902"}}}}