incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1025536 - /incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb
Date Wed, 20 Oct 2010 12:34:34 GMT
Author: mfojtik
Date: Wed Oct 20 12:34:33 2010
New Revision: 1025536

URL: http://svn.apache.org/viewvc?rev=1025536&view=rev
Log:
Fixed HTML issue in Chrome again

Modified:
    incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb

Modified: incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb?rev=1025536&r1=1025535&r2=1025536&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb Wed Oct 20 12:34:33 2010
@@ -102,6 +102,8 @@ module Sinatra
 
         if rack_accept.media_type.to_s.strip.eql?('Accept:')
           format :xml
+        elsif is_chrome?
+          format :html
         else
           format lookup_format_from_mime(rack_accept.best_media_type(accept_to_array))
         end
@@ -109,6 +111,14 @@ module Sinatra
       end
 
       app.class_eval do
+
+        # Simple helper to detect Chrome based browsers
+        # which have screwed up they Accept headers.
+        # Set HTML as default output format here
+        def is_chrome?
+          true if env['HTTP_USER_AGENT'] =~ /Chrome/
+        end
+
         # This code was copied from respond_to plugin
         # http://github.com/cehoffman/sinatra-respond_to
         # MIT License



Mime
View raw message