Skip to content

Commit

Permalink
Recognize the .txt extension as Mime::TEXT [Rick]
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
technoweenie committed Jan 12, 2007
1 parent 88e02f6 commit dd6826e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *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] * 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] * link_to_unless_current works with full URLs as well as paths. #6891 [Jarkko Laine, manfred, idrifter]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/mime_types.rb
@@ -1,5 +1,5 @@
Mime::Type.register "*/*", :all 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/html", :html, %w( application/xhtml+xml ), %w( xhtml )
Mime::Type.register "text/javascript", :js, %w( application/javascript application/x-javascript ) Mime::Type.register "text/javascript", :js, %w( application/javascript application/x-javascript )
Mime::Type.register "text/calendar", :ics Mime::Type.register "text/calendar", :ics
Expand Down
3 changes: 3 additions & 0 deletions actionpack/test/controller/request_test.rb
Expand Up @@ -316,6 +316,9 @@ def test_format
@request.instance_eval { @parameters = { :format => 'xhtml' } } @request.instance_eval { @parameters = { :format => 'xhtml' } }
assert_equal Mime::HTML, @request.format 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.instance_eval { @parameters = { :format => nil } }
@request.env["HTTP_ACCEPT"] = "text/javascript" @request.env["HTTP_ACCEPT"] = "text/javascript"
assert_equal Mime::JS, @request.format assert_equal Mime::JS, @request.format
Expand Down

0 comments on commit dd6826e

Please sign in to comment.