{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/48788950","id":48788950,"diff_hunk":"@@ -1126,3 +1126,46 @@ def test_cookies_set_in_setup_are_persisted_through_the_session\n     assert_equal({\"user_name\"=>\"david\"}, cookies.to_hash)\n   end\n end\n+\n+class IntegrationRequestEncodersTest < ActionDispatch::IntegrationTest\n+  class FooController < ActionController::Base\n+    def foos\n+      render plain: 'ok'\n+    end\n+  end\n+\n+  def test_encoding_as_json\n+    assert_encoded_as :json, content_type: 'application/json'\n+  end\n+\n+  def test_encoding_as_without_mime_registration\n+    assert_raise ArgumentError do\n+      ActionDispatch::IntegrationTest.register_encoder :wibble\n+    end\n+  end\n+\n+  def test_registering_custom_encoder\n+    Mime::Type.register 'text/wibble', :wibble\n+\n+    ActionDispatch::IntegrationTest.register_encoder(:wibble, &:itself)\n+\n+    assert_encoded_as :wibble, content_type: 'text/wibble',\n+      parsed_parameters: Hash.new # Unregistered MIME Type can't be parsed","path":"actionpack/test/controller/integration_test.rb","position":28,"original_position":28,"commit_id":"52bb2d36d3141dcd8217221065d9b5fa2b12deba","original_commit_id":"52bb2d36d3141dcd8217221065d9b5fa2b12deba","user":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"body":"@rafaelfranca tried your suggestion to call a custom controller via curl, but couldn't get it to work.\r\n\r\nWhen I byebug `request_parameters` it seems to `fetch_header` which calls `@env.fetch` which already seems to have an empty hash for that key. Would you have any ideas why? I'll keep digging :grin:","created_at":"2016-01-04T22:12:50Z","updated_at":"2016-01-04T22:12:50Z","html_url":"https://github.com/rails/rails/pull/21671#discussion_r48788950","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/21671","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/48788950"},"html":{"href":"https://github.com/rails/rails/pull/21671#discussion_r48788950"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/21671"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/21671","id":45458998,"html_url":"https://github.com/rails/rails/pull/21671","diff_url":"https://github.com/rails/rails/pull/21671.diff","patch_url":"https://github.com/rails/rails/pull/21671.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/21671","number":21671,"state":"open","locked":false,"title":"Add `as` to encode a request as a specific mime type.","user":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"body":"Turns longish integration test setup like\r\n\r\n```ruby\r\npost articles_path(format: :json), params: { article: { title: 'Ahoy!' } }.to_json,\r\n  headers: { 'Content-Type' => 'application/json' }\r\n```\r\n\r\ninto\r\n\r\n```ruby\r\npost articles_path, params: { article: { title: 'Ahoy!' } }, as: :json\r\n```\r\n\r\nAnd removes the need to add helpers like `post_json` etc.\r\n\r\nI'm not sure if `encoder` is the term to use internally. Perhaps `interpreter` would be better. Suggestions welcome.\r\n\r\nPerhaps we'd need more mime types. Suggestions welcome.","created_at":"2015-09-18T22:21:45Z","updated_at":"2016-01-04T22:12:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"01550d1aeb4e351acbb014e8249943e0311c323c","assignee":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/rails/rails/milestones/47","html_url":"https://github.com/rails/rails/milestones/5.0.0","labels_url":"https://api.github.com/repos/rails/rails/milestones/47/labels","id":1467326,"number":47,"title":"5.0.0","description":"","creator":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":226,"state":"open","created_at":"2015-12-18T21:17:59Z","updated_at":"2016-01-04T22:02:08Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/rails/rails/pulls/21671/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/21671/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/21671/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/52bb2d36d3141dcd8217221065d9b5fa2b12deba","head":{"label":"kaspth:integration-request-encoding-helpers","ref":"integration-request-encoding-helpers","sha":"52bb2d36d3141dcd8217221065d9b5fa2b12deba","user":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"repo":{"id":10581672,"name":"rails","full_name":"kaspth/rails","owner":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaspth/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/kaspth/rails","forks_url":"https://api.github.com/repos/kaspth/rails/forks","keys_url":"https://api.github.com/repos/kaspth/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaspth/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaspth/rails/teams","hooks_url":"https://api.github.com/repos/kaspth/rails/hooks","issue_events_url":"https://api.github.com/repos/kaspth/rails/issues/events{/number}","events_url":"https://api.github.com/repos/kaspth/rails/events","assignees_url":"https://api.github.com/repos/kaspth/rails/assignees{/user}","branches_url":"https://api.github.com/repos/kaspth/rails/branches{/branch}","tags_url":"https://api.github.com/repos/kaspth/rails/tags","blobs_url":"https://api.github.com/repos/kaspth/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaspth/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaspth/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaspth/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaspth/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/kaspth/rails/languages","stargazers_url":"https://api.github.com/repos/kaspth/rails/stargazers","contributors_url":"https://api.github.com/repos/kaspth/rails/contributors","subscribers_url":"https://api.github.com/repos/kaspth/rails/subscribers","subscription_url":"https://api.github.com/repos/kaspth/rails/subscription","commits_url":"https://api.github.com/repos/kaspth/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaspth/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaspth/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaspth/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaspth/rails/contents/{+path}","compare_url":"https://api.github.com/repos/kaspth/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaspth/rails/merges","archive_url":"https://api.github.com/repos/kaspth/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaspth/rails/downloads","issues_url":"https://api.github.com/repos/kaspth/rails/issues{/number}","pulls_url":"https://api.github.com/repos/kaspth/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/kaspth/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/kaspth/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaspth/rails/labels{/name}","releases_url":"https://api.github.com/repos/kaspth/rails/releases{/id}","created_at":"2013-06-09T10:20:15Z","updated_at":"2015-05-04T19:09:39Z","pushed_at":"2016-01-04T22:07:44Z","git_url":"git://github.com/kaspth/rails.git","ssh_url":"git@github.com:kaspth/rails.git","clone_url":"https://github.com/kaspth/rails.git","svn_url":"https://github.com/kaspth/rails","homepage":"http://rubyonrails.org","size":115297,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"rails:master","ref":"master","sha":"9fb4efedfc6409eaf59a8a55771eecacbb9f5c71","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","created_at":"2008-04-11T02:19:47Z","updated_at":"2016-01-04T22:10:00Z","pushed_at":"2016-01-04T22:07:48Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":320797,"stargazers_count":29013,"watchers_count":29013,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11744,"mirror_url":null,"open_issues_count":859,"forks":11744,"open_issues":859,"watchers":29013,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/21671"},"html":{"href":"https://github.com/rails/rails/pull/21671"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/21671"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/21671/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/21671/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/21671/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/52bb2d36d3141dcd8217221065d9b5fa2b12deba"}}}}