aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/mime_types.rb2
-rw-r--r--actionpack/test/controller/request_test.rb3
3 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 29456bf301..c4cab1c037 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Recognize the .txt extension as Mime::TEXT [Rick]
+
* Fix parsing of array[] CGI parameters so extra empty values aren't included. #6252 [Nicholas Seckar, aiwilliams, brentrowland]
* link_to_unless_current works with full URLs as well as paths. #6891 [Jarkko Laine, manfred, idrifter]
diff --git a/actionpack/lib/action_controller/mime_types.rb b/actionpack/lib/action_controller/mime_types.rb
index bc458d85fa..7ddde23073 100644
--- a/actionpack/lib/action_controller/mime_types.rb
+++ b/actionpack/lib/action_controller/mime_types.rb
@@ -1,5 +1,5 @@
Mime::Type.register "*/*", :all
-Mime::Type.register "text/plain", :text
+Mime::Type.register "text/plain", :text, [], %w(txt)
Mime::Type.register "text/html", :html, %w( application/xhtml+xml ), %w( xhtml )
Mime::Type.register "text/javascript", :js, %w( application/javascript application/x-javascript )
Mime::Type.register "text/calendar", :ics
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index f27e71262e..59297a798c 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -316,6 +316,9 @@ class RequestTest < Test::Unit::TestCase
@request.instance_eval { @parameters = { :format => 'xhtml' } }
assert_equal Mime::HTML, @request.format
+ @request.instance_eval { @parameters = { :format => 'txt' } }
+ assert_equal Mime::TEXT, @request.format
+
@request.instance_eval { @parameters = { :format => nil } }
@request.env["HTTP_ACCEPT"] = "text/javascript"
assert_equal Mime::JS, @request.format