Properly handle non existent resources

This commit changes travis-api to always return 404 response if resource
is not available. Previously we were returning image/png with "unknown"
status instead if user used "*/*" Accept header, which was confusing.
This commit is contained in:
Piotr Sarnacki 2013-03-11 23:52:53 +01:00
parent b6f3ef10aa
commit 54a6926aaf
2 changed files with 1 additions and 9 deletions

View File

@ -33,7 +33,7 @@ module Travis::Api::App::Responders
end
def apply?
acceptable_format?
resource && acceptable_format?
end
def format

View File

@ -40,10 +40,6 @@ describe 'v1 repos' do
end
describe 'GET /svenfuchs/minimal.png' do
it '"unknown" when the repository does not exist' do
get('/svenfuchs/does-not-exist.png').should deliver_result_image_for('unknown')
end
it '"unknown" when it only has one build that is not finished' do
Build.delete_all
Factory(:build, repository: repo, state: :created, result: nil)
@ -72,10 +68,6 @@ describe 'v1 repos' do
let(:on_foo) { Factory(:commit, branch: 'foo') }
let(:on_bar) { Factory(:commit, branch: 'bar') }
it '"unknown" when the repository does not exist' do
get('/svenfuchs/does-not-exist.png?branch=foo,bar').should deliver_result_image_for('unknown')
end
it '"unknown" when it only has unfinished builds on the relevant branches' do
Build.delete_all
Factory(:build, repository: repo, state: :started, commit: on_foo)