{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/20729","labels_url":"https://api.github.com/repos/rails/rails/issues/20729/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/20729/comments","events_url":"https://api.github.com/repos/rails/rails/issues/20729/events","html_url":"https://github.com/rails/rails/issues/20729","id":91691285,"number":20729,"title":"ActionDispatch response headers for status code 205","user":{"login":"lazylester","id":188651,"avatar_url":"https://avatars.githubusercontent.com/u/188651?v=3","gravatar_id":"","url":"https://api.github.com/users/lazylester","html_url":"https://github.com/lazylester","followers_url":"https://api.github.com/users/lazylester/followers","following_url":"https://api.github.com/users/lazylester/following{/other_user}","gists_url":"https://api.github.com/users/lazylester/gists{/gist_id}","starred_url":"https://api.github.com/users/lazylester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lazylester/subscriptions","organizations_url":"https://api.github.com/users/lazylester/orgs","repos_url":"https://api.github.com/users/lazylester/repos","events_url":"https://api.github.com/users/lazylester/events{/privacy}","received_events_url":"https://api.github.com/users/lazylester/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-29T04:21:04Z","updated_at":"2015-06-29T06:02:55Z","closed_at":null,"body":"In the file lib/action_dispatch/http/response.rb, a constant called NO_CONTENT_CODES has a list of status codes for which the CONTENT_TYPE header should be deleted.\r\n\r\nThere is similar behaviour in Rack, (see the commit https://github.com/rack/rack/commit/2c5b076aaba6c83ffce8c6c2b5c49085c1abb5a5), but they have included the 205 response code. I believe this is the correct and desirable behaviour and that the NO_CONTENT_CODES list in ActionDispatch::Response should be changed from [204, 304] to [204, 205, 304].\r\n\r\nNote that in Rack, they also remove the CONTENT_LENGTH header for status code 205. I don't know if this is the correct behaviour, but I imagine that the Rack folks thought so.\r\n\r\nIf there is agreement that this change should be made, I'll submit a PR."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/116458773","html_url":"https://github.com/rails/rails/issues/20729#issuecomment-116458773","issue_url":"https://api.github.com/repos/rails/rails/issues/20729","id":116458773,"user":{"login":"matthewd","id":1034,"avatar_url":"https://avatars.githubusercontent.com/u/1034?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewd","html_url":"https://github.com/matthewd","followers_url":"https://api.github.com/users/matthewd/followers","following_url":"https://api.github.com/users/matthewd/following{/other_user}","gists_url":"https://api.github.com/users/matthewd/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewd/subscriptions","organizations_url":"https://api.github.com/users/matthewd/orgs","repos_url":"https://api.github.com/users/matthewd/repos","events_url":"https://api.github.com/users/matthewd/events{/privacy}","received_events_url":"https://api.github.com/users/matthewd/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T06:02:55Z","updated_at":"2015-06-29T06:02:55Z","body":"[RFC7231 6.3.6](https://tools.ietf.org/html/rfc7231#section-6.3.6):\r\n\r\n> Since the 205 status code implies that no additional content will be provided, a server MUST NOT generate a payload in a 205 response.  In other words, a server MUST do one of the following for a 205 response: a) indicate a zero-length body for the response by including a Content-Length header field with a value of 0; b) indicate a zero-length payload for the response by including a Transfer-Encoding header field with a value of chunked and a message body consisting of a single chunk of zero-length; or, c) close the connection immediately after sending the blank line terminating the header section.\r\n\r\nand [3.1.1.5](https://tools.ietf.org/html/rfc7231#section-3.1.1.5) (emphasis mine):\r\n\r\n> A sender that generates a message **containing a payload body** SHOULD generate a Content-Type header field in that message\r\n\r\n---\r\n\r\nAgreed. It seems pointless, at best, for us to include a Content-Type for a 205 -- and inconsistent for us to not actively suppress the body.\r\n\r\nThe above also seems to clearly state that Rack's no-Content-Length-allowed behaviour is wrong; if you're interested, a PR to fix that would be welcome too. (It seems to just be a consequence of https://github.com/rack/rack/pull/221 adding 205 to the other no-content responses -- [1xx and 204 do indeed carry a MUST NOT prohibition](https://tools.ietf.org/html/rfc7230#section-3.3.2).)"}}