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:
parent
4fd866d113
commit
8e12ddf7ed
2 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue