also redirect "Accept: */*" to the api
This commit is contained in:
parent
d19d5003d0
commit
f8ab48178e
|
@ -31,7 +31,7 @@ class Travis::Web::ApiRedirect < Sinatra::Base
|
|||
end
|
||||
|
||||
def api_call?
|
||||
return true if request.accept.empty?
|
||||
return true if request.accept.empty? or env['HTTP_ACCEPT'] == '*/*'
|
||||
preferred = request.preferred_type(*settings.frontend_types, *settings.api_types)
|
||||
settings.api_types.include? preferred
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ describe Travis::Web::ApiRedirect do
|
|||
end
|
||||
|
||||
it 'does not redirect catch-all with generic Accept header' do
|
||||
get('/foo/bar', {}, 'HTTP_ACCEPT' => '*/*').should_not be_redirect
|
||||
get('/foo/bar', {}, 'HTTP_ACCEPT' => '*/*').should be_redirect
|
||||
end
|
||||
|
||||
it 'redirects catch-all without Accept header' do
|
||||
|
|
Loading…
Reference in New Issue
Block a user