1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

fix for issues #999: HTTP_ACCEPT=*/* should redirect to the default location

This commit is contained in:
Emanuel Carnevale 2011-04-29 13:22:52 +02:00
parent 4fd866d113
commit 8e12ddf7ed
2 changed files with 8 additions and 1 deletions

View file

@ -65,7 +65,9 @@ module Devise
end
def redirect_url
if request_format == :html
if [:html, :"*/*", "*/*"].include? request_format
#if is_navigational_format?
#if request_format == :html
send(:"new_#{scope}_session_path")
else
send(:"new_#{scope}_session_path", :format => request_format)

View file

@ -39,6 +39,11 @@ class FailureTest < ActiveSupport::TestCase
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
end
test 'return to the default redirect location for wildcard requests' do
call_failure 'action_dispatch.request.formats' => nil, 'HTTP_ACCEPT' => '*/*'
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
end
test 'uses the proxy failure message as symbol' do
call_failure('warden' => OpenStruct.new(:message => :test))
assert_equal 'test', @request.flash[:alert]