aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/head.rb
diff options
context:
space:
mode:
authorKunal Shah <me@kunalashah.com>2012-05-07 18:56:36 -0400
committerKunal Shah <me@kunalashah.com>2012-05-08 03:11:17 -0400
commit3ca28dec0f5a4c41816f187dc31a922be5ebff89 (patch)
tree9d4442715bd85b5c4822f642c0e531907ff1f91b /actionpack/lib/action_controller/metal/head.rb
parentc52ba1b372be08b46fd94deaf1ff382463785c7f (diff)
downloadrails-3ca28dec0f5a4c41816f187dc31a922be5ebff89.tar.gz
rails-3ca28dec0f5a4c41816f187dc31a922be5ebff89.tar.bz2
rails-3ca28dec0f5a4c41816f187dc31a922be5ebff89.zip
If content_type is explicitly passed to the :head method use the value or fallback
Diffstat (limited to 'actionpack/lib/action_controller/metal/head.rb')
-rw-r--r--actionpack/lib/action_controller/metal/head.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb
index 5bdbde9ebb..2fcd933d32 100644
--- a/actionpack/lib/action_controller/metal/head.rb
+++ b/actionpack/lib/action_controller/metal/head.rb
@@ -20,6 +20,7 @@ module ActionController
options, status = status, nil if status.is_a?(Hash)
status ||= options.delete(:status) || :ok
location = options.delete(:location)
+ content_type = options.delete(:content_type)
options.each do |key, value|
headers[key.to_s.dasherize.split('-').each { |v| v[0] = v[0].chr.upcase }.join('-')] = value.to_s
@@ -29,7 +30,7 @@ module ActionController
self.location = url_for(location) if location
if include_content_headers?(self.status)
- self.content_type = Mime[formats.first] if formats
+ self.content_type = content_type || (Mime[formats.first] if formats)
else
headers.delete('Content-Type')
headers.delete('Content-Length')