On 02/22/2010 07:34 AM, mfojtik@redhat.com wrote:
server/libexec/lib/sinatra/respond_to.rb | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/server/libexec/lib/sinatra/respond_to.rb b/server/libexec/lib/sinatra/respond_to.rb index 8e54bda..a79e099 100644 --- a/server/libexec/lib/sinatra/respond_to.rb +++ b/server/libexec/lib/sinatra/respond_to.rb @@ -237,6 +237,11 @@ module Sinatra def match_accept_type(mime_types, format) selected = [] accepted_types = mime_types.map {|type| Regexp.escape(type).gsub(/\*/,'.*') }
# Fix for Chrome:
if accepted_types.include?('text/html') and accepted_types.include?('application/xml')
accepted_types.delete('text/html')
accepted_types.insert(0, 'text/html')
end accepted_types.each do |at| format.each do |fmt, ht, handler| (selected = [fmt, ht, handler]) and break if ht.match(at)
Yeah, I ran into this too. While it is early on, and we aren't guaranteeing backwards-compatibility yet, the cost of doing this is close to zero.
ACK