Won't work with Rails 3.0.x because of Rack 1.2.x bug #63

seamusabshere opened this Issue Apr 11, 2012 · 1 comment


None yet

2 participants



  1. If you use Rails 3.0.12, you are stuck with Rack 1.2.5
  2. Rack 1.2.5 blows up if env['CONTENT_TYPE'] == "" and you call Rack::Request#media_type (or any other method that calls it, such as the very common pattern Rack::Request.new(env).params) per a bug that was fixed in later versions
  3. At the same time, Rack::Lint complains if you set env['CONTENT_TYPE'] to nil.

Possible solution

I think unicorn (accidentially? intentionally?) solves this by defaulting to text/html... but I could be wrong:

# https://github.com/defunkt/unicorn/blob/master/lib/unicorn/cgi_wrapper.rb#L95
@head[CONTENT_TYPE] ||= "text/html"

So puma could default to text/html (?).

evanphx commented Apr 11, 2012

It doesn't appear that Rack has fixed the bug even. I think I'll set to "text/plain" as the default.

@evanphx evanphx closed this in 3051daf Apr 11, 2012
@pd pd added a commit to pd/httpie-api-auth that referenced this issue Dec 24, 2014
@pd pd Remove 'text/plain' hack
In my case, it was puma injecting `text/plain` as the default
Content-Type value during request processing.

See evanphx's comment on puma/puma#63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment