Commit 373092e6 authored by James Lopez's avatar James Lopez

update API

parent 83e19b75
......@@ -70,6 +70,11 @@ module API
if result[:status] == :success
commit_detail = user_project.repository.commit(result[:result])
if verified_request? && current_request.env['warden']&.authenticate
::Gitlab::Metrics::MultiFileEditor.new(user_project, current_user, commit_detail).record
end
present commit_detail, with: Entities::CommitDetail
else
render_api_error!(result[:message], 400)
......
......@@ -245,6 +245,12 @@ describe API::Commits do
expect(json_response['committer_email']).to eq(user.email)
end
it 'does not call the metrics using access token authentication' do
post api(url, user), valid_c_params
expect_any_instance_of(::Gitlab::Metrics::MultiFileEditor).not_to receive(:record)
end
it 'returns a 400 bad request if file exists' do
post api(url, user), invalid_c_params
......
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