Commit 658c413c authored by Thong Kuah's avatar Thong Kuah

Merge branch 'restrict_pagination_per_page_values' into 'master'

Restrict pagination per_page possible values

See merge request gitlab-org/gitlab!79479
parents b4145f3f 459e83fd
......@@ -18,7 +18,7 @@ module API
helpers do
params :pagination do
optional :page, type: Integer, default: 1, desc: 'Current page number'
optional :per_page, type: Integer, default: 20, desc: 'Number of items per page'
optional :per_page, type: Integer, default: 20, desc: 'Number of items per page', except_values: [0]
end
end
end
......
......@@ -227,6 +227,12 @@ RSpec.describe API::Commits do
expect(response.headers['X-Page']).to eq('3')
end
end
context 'when per_page is 0' do
let(:per_page) { 0 }
it_behaves_like '400 response'
end
end
context 'with order parameter' do
......
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