Commit 8ab347b3 authored by Adam Niedzielski's avatar Adam Niedzielski

Return 404 in project issues API endpoint when project cannot be found

Closes #29631
parent a1a04828
---
title: Return 404 in project issues API endpoint when project cannot be found
merge_request: 10093
author:
......@@ -91,7 +91,7 @@ module API
use :issues_params
end
get ":id/issues" do
project = find_project(params[:id])
project = find_project!(params[:id])
issues = find_issues(project_id: project.id)
......
......@@ -103,7 +103,7 @@ module API
use :issues_params
end
get ":id/issues" do
project = find_project(params[:id])
project = find_project!(params[:id])
issues = find_issues(project_id: project.id)
......
......@@ -534,6 +534,12 @@ describe API::Issues, api: true do
describe "GET /projects/:id/issues" do
let(:base_url) { "/projects/#{project.id}" }
it 'returns 404 when project does not exist' do
get api('/projects/1000/issues', non_member)
expect(response).to have_http_status(404)
end
it "returns 404 on private projects for other users" do
private_project = create(:empty_project, :private)
create(:issue, project: private_project)
......
......@@ -439,6 +439,12 @@ describe API::V3::Issues, api: true do
describe "GET /projects/:id/issues" do
let(:base_url) { "/projects/#{project.id}" }
it 'returns 404 when project does not exist' do
get v3_api('/projects/1000/issues', non_member)
expect(response).to have_http_status(404)
end
it "returns 404 on private projects for other users" do
private_project = create(:empty_project, :private)
create(:issue, project: private_project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment