Skip to content
Snippets Groups Projects
Commit cb32e032 authored by Nihad Abbasov's avatar Nihad Abbasov
Browse files

return 404 if project not found

parent f7dd0674
No related branches found
No related tags found
1 merge request!1142API changes
Loading
Loading
@@ -5,8 +5,13 @@ module Gitlab
end
 
def user_project
@project ||= current_user.projects.find_by_id(params[:id]) ||
current_user.projects.find_by_code(params[:id])
if @project ||= current_user.projects.find_by_id(params[:id]) ||
current_user.projects.find_by_code(params[:id])
else
error!({'message' => '404 Not found'}, 404)
end
@project
end
 
def authenticate!
Loading
Loading
Loading
Loading
@@ -36,6 +36,12 @@ describe Gitlab::API do
response.status.should == 200
json_response['name'].should == project.name
end
it "should return a 404 error if not found" do
get "#{api_prefix}/projects/42?private_token=#{user.private_token}"
response.status.should == 404
json_response['message'].should == '404 Not found'
end
end
 
describe "GET /projects/:id/repository/branches" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment