Permalink
Browse files

Fix a problem with IE7 headers.

  • Loading branch information...
1 parent f49efdf commit 835d1044ae00b5d721261fc5c40790439794ac27 @josevalim josevalim committed Nov 8, 2010
Showing with 11 additions and 3 deletions.
  1. +1 −1 lib/devise.rb
  2. +5 −2 lib/generators/templates/devise.rb
  3. +5 −0 test/failure_app_test.rb
View
@@ -170,7 +170,7 @@ module Strategies
# Which formats should be treated as navigational.
mattr_accessor :navigational_formats
- @@navigational_formats = [:html]
+ @@navigational_formats = [:"*/*", :html]
# When set to true, signing out an user signs out all other scopes.
mattr_accessor :sign_out_all_scopes
@@ -141,9 +141,12 @@
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
+ #
# If you have any extra navigational formats, like :iphone or :mobile, you
- # should add them to the navigational formats lists. Default is [:html]
- # config.navigational_formats = [:html, :iphone]
+ # should add them to the navigational formats lists.
+ #
+ # The :"*/*" format below is required to match Internet Explorer requests.
+ # config.navigational_formats = [:"*/*", :html]
# The default HTTP method used to sign out a resource. Default is :get.
# config.sign_out_via = :get
View
@@ -28,6 +28,11 @@ def call_failure(env_params={})
assert_equal 302, @response.first
end
+ test 'return 302 status for wildcard requests' do
+ call_failure 'action_dispatch.request.formats' => nil, 'HTTP_ACCEPT' => '*/*'
+ assert_equal 302, @response.first
+ end
+
test 'return to the default redirect location' do
call_failure
assert_equal 'You need to sign in or sign up before continuing.', @request.flash[:alert]

0 comments on commit 835d104

Please sign in to comment.