Use Accept entries for getting API version
This commit is contained in:
parent
a1b421a7fa
commit
857af4fde0
|
@ -82,7 +82,7 @@ class Travis::Api::App
|
||||||
end
|
end
|
||||||
|
|
||||||
def accept_version
|
def accept_version
|
||||||
@accept_version ||= request.accept.join =~ HEADER_FORMAT && "v#{$1}" || DEFAULT_VERSION
|
@accept_version ||= accept_entries.map(&:version).compact.first || DEFAULT_VERSION
|
||||||
end
|
end
|
||||||
|
|
||||||
def accept_format
|
def accept_format
|
||||||
|
|
|
@ -34,6 +34,11 @@ describe 'v1 repos' do
|
||||||
response.should redirect_to('/repositories/svenfuchs/minimal.json')
|
response.should redirect_to('/repositories/svenfuchs/minimal.json')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'GET /svenfuchs/minimal' do
|
||||||
|
response = get '/svenfuchs/minimal.json', {}, 'HTTP_ACCEPT' => 'application/json; version=2'
|
||||||
|
response.status.should == 404
|
||||||
|
end
|
||||||
|
|
||||||
it 'GET /svenfuchs/minimal/cc.xml' do
|
it 'GET /svenfuchs/minimal/cc.xml' do
|
||||||
response = get '/svenfuchs/minimal/cc.xml'
|
response = get '/svenfuchs/minimal/cc.xml'
|
||||||
response.should redirect_to('/repositories/svenfuchs/minimal/cc.xml')
|
response.should redirect_to('/repositories/svenfuchs/minimal/cc.xml')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user