Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3850

Show
Ignore:
Timestamp:
03/12/06 19:01:09 (3 years ago)
Author:
david
Message:

Prepare for mime type reordering depending on the branch [DHH]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/mime_type.rb

    r3849 r3850  
    33    def self.lookup(string) 
    44      LOOKUP[string] 
     5    end 
     6 
     7    def self.parse(accept_header) 
     8      accept_header.split(",").collect! do |mime_type| 
     9        Mime::Type.lookup(mime_type.split(";").first.strip) 
     10      end 
    511    end 
    612     
     
    3440  HTML  = Type.new "text/html", :html, %w( application/xhtml+xml ) 
    3541  JS    = Type.new "text/javascript", :js, %w( application/javascript application/x-javascript ) 
    36   XML   = Type.new "application/xml", :xml, %w( text/xml application/x-xml ) 
     42  XML   = Type.new "application/xml", :xml, %w( application/x-xml ) 
    3743  RSS   = Type.new "application/rss+xml", :rss 
    3844  ATOM  = Type.new "application/atom+xml", :atom 
  • trunk/actionpack/lib/action_controller/request.rb

    r3847 r3850  
    7171        [ content_type, Mime::ALL ] 
    7272      else 
    73         @env['HTTP_ACCEPT'].split(",").collect! do |mime_type| 
    74           Mime::Type.lookup(mime_type.split(";").first.strip) 
    75         end 
     73        Mime::Type.parse(@env['HTTP_ACCEPT']) 
    7674      end 
    7775    end