{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/24147","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/24147/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/24147/comments","events_url":"https://api.github.com/repos/rails/rails/issues/24147/events","html_url":"https://github.com/rails/rails/issues/24147","id":140014167,"number":24147,"title":"Empty body for JSON requests with status codes 4xx and 5xx","user":{"login":"haslinger","id":1116624,"avatar_url":"https://avatars.githubusercontent.com/u/1116624?v=3","gravatar_id":"","url":"https://api.github.com/users/haslinger","html_url":"https://github.com/haslinger","followers_url":"https://api.github.com/users/haslinger/followers","following_url":"https://api.github.com/users/haslinger/following{/other_user}","gists_url":"https://api.github.com/users/haslinger/gists{/gist_id}","starred_url":"https://api.github.com/users/haslinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haslinger/subscriptions","organizations_url":"https://api.github.com/users/haslinger/orgs","repos_url":"https://api.github.com/users/haslinger/repos","events_url":"https://api.github.com/users/haslinger/events{/privacy}","received_events_url":"https://api.github.com/users/haslinger/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/actionpack","name":"actionpack","color":"FFF700"}],"state":"closed","locked":false,"assignee":null,"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":16,"closed_issues":397,"state":"open","created_at":"2015-12-18T21:17:59Z","updated_at":"2016-03-11T07:39:01Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-03-10T21:28:37Z","updated_at":"2016-03-11T07:39:01Z","closed_at":"2016-03-11T07:39:01Z","body":"### Steps to reproduce\r\n\r\nCreating a minimalist app with a routes.rb :\r\n```\r\nRails.application.routes.draw do\r\n  get 'error' => 'application#test', defaults: { format: :json }\r\n  get 'working' => 'application#test2', defaults: { format: :json }\r\nend\r\n```\r\n\r\nand an application_controller.rb :\r\n```\r\nclass ApplicationController < ActionController::Base\r\n  protect_from_forgery with: :exception\r\n  skip_before_action :verify_authenticity_token\r\n\r\n  def test\r\n    render json: {error: \"i wont show up\"} , status: 422\r\n  end\r\n\r\n  def test2\r\n    render json: {fine: \"i do show ap\"} , status: 200\r\n  end\r\nend\r\n```\r\n\r\n### Expected behavior\r\nGet requests to /error and /working should result in responses with an existing body.\r\n\r\n### Actual behavior\r\nWhile /working works fine, /error only responds with the correct error code, but with an empty body in development as well as in production.\r\nSetting   `config.debug_exception_response_format = :api` doesn't change this behavior.\r\n\r\n### System configuration\r\n**Rails version**: 5.0.0.beta3\r\n\r\n**Ruby version**: 2.3.0p0\r\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/195235071","html_url":"https://github.com/rails/rails/issues/24147#issuecomment-195235071","issue_url":"https://api.github.com/repos/rails/rails/issues/24147","id":195235071,"user":{"login":"haslinger","id":1116624,"avatar_url":"https://avatars.githubusercontent.com/u/1116624?v=3","gravatar_id":"","url":"https://api.github.com/users/haslinger","html_url":"https://github.com/haslinger","followers_url":"https://api.github.com/users/haslinger/followers","following_url":"https://api.github.com/users/haslinger/following{/other_user}","gists_url":"https://api.github.com/users/haslinger/gists{/gist_id}","starred_url":"https://api.github.com/users/haslinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haslinger/subscriptions","organizations_url":"https://api.github.com/users/haslinger/orgs","repos_url":"https://api.github.com/users/haslinger/repos","events_url":"https://api.github.com/users/haslinger/events{/privacy}","received_events_url":"https://api.github.com/users/haslinger/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T07:39:01Z","updated_at":"2016-03-11T07:39:01Z","body":"@maclover7 Thank you for response, you helped me debugging and solved my issue.\r\nI created a [gist](https://gist.github.com/haslinger/b08b473e63574ba33196), that proved me wrong. The response is correct.\r\n\r\nWhat misled me was, that I was using wget for testing the response, that doesn't load the body for the status 422 case, while curl does it correctly.\r\n\r\nThank you for your time!\r\n"}}