mirror of
https://github.com/github/rails.git
synced 2026-02-07 20:54:57 -05:00
Prepare for mime type reordering depending on the branch [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3850 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -3,6 +3,12 @@ module Mime
|
||||
def self.lookup(string)
|
||||
LOOKUP[string]
|
||||
end
|
||||
|
||||
def self.parse(accept_header)
|
||||
accept_header.split(",").collect! do |mime_type|
|
||||
Mime::Type.lookup(mime_type.split(";").first.strip)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(string, symbol = nil, synonyms = [])
|
||||
@symbol, @synonyms = symbol, synonyms
|
||||
@@ -33,7 +39,7 @@ module Mime
|
||||
ALL = Type.new "*/*", :all
|
||||
HTML = Type.new "text/html", :html, %w( application/xhtml+xml )
|
||||
JS = Type.new "text/javascript", :js, %w( application/javascript application/x-javascript )
|
||||
XML = Type.new "application/xml", :xml, %w( text/xml application/x-xml )
|
||||
XML = Type.new "application/xml", :xml, %w( application/x-xml )
|
||||
RSS = Type.new "application/rss+xml", :rss
|
||||
ATOM = Type.new "application/atom+xml", :atom
|
||||
YAML = Type.new "application/x-yaml", :yaml
|
||||
|
||||
@@ -70,9 +70,7 @@ module ActionController
|
||||
@accepts = if @env['HTTP_ACCEPT'].to_s.strip.blank?
|
||||
[ content_type, Mime::ALL ]
|
||||
else
|
||||
@env['HTTP_ACCEPT'].split(",").collect! do |mime_type|
|
||||
Mime::Type.lookup(mime_type.split(";").first.strip)
|
||||
end
|
||||
Mime::Type.parse(@env['HTTP_ACCEPT'])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user