diff options
author | Tobias Lütke <tobi@jadedpixel.com> | 2008-05-01 17:45:14 -0400 |
---|---|---|
committer | Tobias Lütke <tobi@jadedpixel.com> | 2008-05-01 17:45:14 -0400 |
commit | f48e89931f3dfe0571f62f926c01cb7783814347 (patch) | |
tree | 7c6150a8cceb84307f152664fb73d7149c9c51f3 /actionpack/test | |
parent | f122ca58745f6218cb531fb683b97686254fea5d (diff) | |
download | rails-f48e89931f3dfe0571f62f926c01cb7783814347.tar.gz rails-f48e89931f3dfe0571f62f926c01cb7783814347.tar.bz2 rails-f48e89931f3dfe0571f62f926c01cb7783814347.zip |
Accept header mime parser can now deal with empty fields
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime_type_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_type_test.rb b/actionpack/test/controller/mime_type_test.rb index 991ac04f62..03b0f8bad2 100644 --- a/actionpack/test/controller/mime_type_test.rb +++ b/actionpack/test/controller/mime_type_test.rb @@ -28,6 +28,13 @@ class MimeTypeTest < Test::Unit::TestCase expect = [Mime::HTML, Mime::XML, "image/*", Mime::TEXT, Mime::ALL] assert_equal expect, Mime::Type.parse(accept).collect { |c| c.to_s } end + + # Accept header send with user HTTP_USER_AGENT: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1) + def test_parse_crappy_broken_acceptlines2 + accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, , pronto/1.00.00, sslvpn/1.00.00.00, */*" + expect = ['image/gif', 'image/x-xbitmap', 'image/jpeg','image/pjpeg', 'application/x-shockwave-flash', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/msword', 'pronto/1.00.00', 'sslvpn/1.00.00.00', Mime::ALL ] + assert_equal expect, Mime::Type.parse(accept).collect { |c| c.to_s } + end def test_custom_type Mime::Type.register("image/gif", :gif) |