Make ActionController#head pass rack-link #6148

merged 2 commits into from May 4, 2012


None yet

3 participants


This commit makes head responses pass rack-lint. I came across this bug while implementing HTTP caching in our application. According to rack-lint the content-type header must not be present for 1xx, 204, 205, and 304. I was getting weird 500s in our app because responses were blowing up in rack-lint. This commit fixes that. All the other tests pass.

@jonleighton jonleighton merged commit 8edd21c into rails:master May 4, 2012

@twinturbo I commented in #3436 but I'm also wondering why rack-lint has this requirement. From RFC2616:

14.17 Content-Type

The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or,
in the case of the HEAD method, the media type that would have been sent had the request been a GET.

I'm not sure why rack-lint has this requirement


rack-link references RFC3875 which specifies:

6.3.1. Content-Type

The Content-Type response field sets the Internet Media Type [6] of
the entity body.

  Content-Type = "Content-Type:" media-type NL

If an entity body is returned, the script MUST supply a Content-Type
field in the response. If it fails to do so, the server SHOULD NOT
attempt to determine the correct content type. The value SHOULD be
sent unmodified to the client, except for any charset parameter

If I'm reading this correctly the issue is with rack-lint.

L472 of

I'm going to open an issue in that project...



If an entity body is returned

That's the key. Those codes should have no body.


@twinturbo Aha! I see it now. My reading of "If it fails to do so" was incorrect. Sorry for the noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment