aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/base.rb2
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb10
3 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 9d6dcfc80d..23da55ca6b 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added support for Mime objects in render :content_type option [DHH]. Example: render :text => some_atom, :content_type => Mime::ATOM
+
* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 [Manfred Stienstra <m.stienstra@fngtps.com>]
* Routing rewrite. Simpler, faster, easier to understand. The published API for config/routes.rb is unchanged, but nearly everything else is different, so expect breakage in plugins and libs that try to fiddle with routes. [Nicholas Seckar, Jamis Buck]
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 0902e70082..38a255192e 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -649,7 +649,7 @@ module ActionController #:nodoc:
end
if content_type = options[:content_type]
- headers["Content-Type"] = content_type
+ headers["Content-Type"] = content_type.to_s
end
if text = options[:text]
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index bd9c8c1ff8..0ef31cb851 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -61,6 +61,10 @@ class ActionPackAssertionsController < ActionController::Base
render_text "<div>#{url_for(:action => 'flash_me', :only_path => true)}</div>"
end
+ def render_text_with_custom_content_type
+ render :text => "Hello!", :content_type => Mime::RSS
+ end
+
# puts something in the session
def session_stuffing
session['xmas'] = 'turkey'
@@ -532,4 +536,10 @@ class ActionPackHeaderTest < Test::Unit::TestCase
process :hello_xml_world
assert_equal('application/pdf', @controller.headers['Content-Type'])
end
+
+
+ def test_render_text_with_custom_content_type
+ get :render_text_with_custom_content_type
+ assert_equal 'application/rss+xml', @response.headers['Content-Type']
+ end
end