From e52c28a425192966379ecf4ae3b20f0b9442e9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Mon, 5 Mar 2007 18:24:17 +0000 Subject: Ignore odd charset declaration in CONTENT_TYPE header which would throw off mime type lookup. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6340 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/request_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 59297a798c..4914df679c 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -323,6 +323,25 @@ class RequestTest < Test::Unit::TestCase @request.env["HTTP_ACCEPT"] = "text/javascript" assert_equal Mime::JS, @request.format end + + def test_content_type + @request.env["CONTENT_TYPE"] = "text/html" + assert_equal Mime::HTML, @request.content_type + end + + def test_content_no_type + assert_equal nil, @request.content_type + end + + def test_content_type_xml + @request.env["CONTENT_TYPE"] = "application/xml" + assert_equal Mime::XML, @request.content_type + end + + def test_content_type_with_charset + @request.env["CONTENT_TYPE"] = "application/xml; charset=UTF-8" + assert_equal Mime::XML, @request.content_type + end protected def set_request_method_to(method) -- cgit v1.2.3