Commit 0610640f authored by Andreas Brandl's avatar Andreas Brandl

Error 405 for unsupported keyset pagination calls

This is in line with what we document:
https://docs.gitlab.com/ee/api/README.html#status-codes
parent 8e71bd07
......@@ -9,7 +9,7 @@ module API
request_context = Gitlab::Pagination::Keyset::RequestContext.new(self)
unless Gitlab::Pagination::Keyset.available?(request_context, relation)
return error!('Keyset pagination is not yet available for this type of request', 501)
return error!('Keyset pagination is not yet available for this type of request', 405)
end
Gitlab::Pagination::Keyset.paginate(request_context, relation)
......
......@@ -47,7 +47,7 @@ describe API::Helpers::Pagination do
it 'renders a 501 error if keyset pagination isnt available yet' do
expect(Gitlab::Pagination::Keyset).to receive(:available?).with(request_context, relation).and_return(false)
expect(Gitlab::Pagination::Keyset).not_to receive(:paginate)
expect(subject).to receive(:error!).with(/not yet available/, 501)
expect(subject).to receive(:error!).with(/not yet available/, 405)
subject.paginate(relation)
end
......
......@@ -632,7 +632,7 @@ describe API::Projects do
it 'responds with 501 if order_by is different from id' do
get api('/projects', current_user), params: params.merge(order_by: :created_at)
expect(response).to have_gitlab_http_status(501)
expect(response).to have_gitlab_http_status(405)
end
end
......
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