Changeset 4399
- Timestamp:
- 06/01/06 23:23:24 (2 years ago)
- Files:
-
- trunk/actionpack/lib/action_controller/mime_type.rb (modified) (3 diffs)
- trunk/actionpack/test/controller/mime_type_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/mime_type.rb
r4384 r4399 35 35 # keep track of creation order to keep the subsequent sort stable 36 36 index = 0 37 list = accept_header.split(/,/). 38 map! { |i| AcceptItem.new(index += 1, *i.split(/;\s*q=/)) }.sort! 37 list = accept_header.split(/,/).map! do |i| 38 AcceptItem.new(index += 1, *i.split(/;\s*q=/)) 39 end.sort! 39 40 40 41 # Take care of the broken text/xml entry by renaming or deleting it 41 42 42 text_xml = list.index("text/xml") 43 43 app_xml = list.index("application/xml") … … 121 121 122 122 123 LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) }123 LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k == "" } 124 124 125 125 LOOKUP["*/*"] = ALL … … 143 143 144 144 145 EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) }145 EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k == "" } 146 146 147 147 EXTENSION_LOOKUP["html"] = HTML trunk/actionpack/test/controller/mime_type_test.rb
r4394 r4399 6 6 7 7 def test_parse_single 8 p Mime::LOOKUP.keys.sort9 8 Mime::LOOKUP.keys.each do |mime_type| 10 9 assert_equal [Mime::Type.lookup(mime_type)], Mime::Type.parse(mime_type)