diff options
author | twinturbo <me@broadcastingadam.com> | 2012-05-03 15:47:02 -0700 |
---|---|---|
committer | twinturbo <me@broadcastingadam.com> | 2012-05-03 16:18:51 -0700 |
commit | 8eedd1a4a7bed400d0daed1fecafc4f84c5561f2 (patch) | |
tree | e381013b9603234d9424cbd682f8d77245b9525f /actionpack/lib/action_controller/metal/head.rb | |
parent | 7d5146efad1c3bd471f315e4d259e00052eacbb6 (diff) | |
download | rails-8eedd1a4a7bed400d0daed1fecafc4f84c5561f2.tar.gz rails-8eedd1a4a7bed400d0daed1fecafc4f84c5561f2.tar.bz2 rails-8eedd1a4a7bed400d0daed1fecafc4f84c5561f2.zip |
Make ActionController#head pass rack-link
Diffstat (limited to 'actionpack/lib/action_controller/metal/head.rb')
-rw-r--r-- | actionpack/lib/action_controller/metal/head.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb index a618533d09..802c44cc73 100644 --- a/actionpack/lib/action_controller/metal/head.rb +++ b/actionpack/lib/action_controller/metal/head.rb @@ -27,8 +27,27 @@ module ActionController self.status = status self.location = url_for(location) if location - self.content_type = Mime[formats.first] if formats + + if include_content_type?(self.status) + self.content_type = Mime[formats.first] if formats + else + headers.delete('Content-Type') + end + self.response_body = " " end + + private + # :nodoc: + def include_content_type?(status) + case status + when 100..199 + false + when 204, 205, 304 + false + else + true + end + end end end |