From 8eedd1a4a7bed400d0daed1fecafc4f84c5561f2 Mon Sep 17 00:00:00 2001 From: twinturbo Date: Thu, 3 May 2012 15:47:02 -0700 Subject: Make ActionController#head pass rack-link --- actionpack/lib/action_controller/metal/head.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/metal/head.rb') 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 -- cgit v1.2.3