Commit 5a908ac3 authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets Committed by Terri Chu

Change error tracking collector status code

Change from 204 no content to 200 OK because some SDK explicitly check
for 200 to decide if error submit request was valid or not.

Changelog: changed
Signed-off-by: default avatarDmytro Zaporozhets <dzaporozhets@gitlab.com>
parent 12d94b5a
...@@ -96,7 +96,10 @@ module API ...@@ -96,7 +96,10 @@ module API
# Collector should never return any information back. # Collector should never return any information back.
# Because DSN and public key are designed for public use, # Because DSN and public key are designed for public use,
# it is safe only for submission of new events. # it is safe only for submission of new events.
no_content! #
# Some clients sdk require status 200 OK to work correctly.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/343531.
status 200
end end
desc 'Submit error tracking event to the project' do desc 'Submit error tracking event to the project' do
...@@ -129,7 +132,10 @@ module API ...@@ -129,7 +132,10 @@ module API
# Collector should never return any information back. # Collector should never return any information back.
# Because DSN and public key are designed for public use, # Because DSN and public key are designed for public use,
# it is safe only for submission of new events. # it is safe only for submission of new events.
no_content! #
# Some clients sdk require status 200 OK to work correctly.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/343531.
status 200
end end
end end
end end
...@@ -24,10 +24,10 @@ RSpec.describe API::ErrorTracking::Collector do ...@@ -24,10 +24,10 @@ RSpec.describe API::ErrorTracking::Collector do
end end
RSpec.shared_examples 'successful request' do RSpec.shared_examples 'successful request' do
it 'writes to the database and returns no content' do it 'writes to the database and returns OK' do
expect { subject }.to change { ErrorTracking::ErrorEvent.count }.by(1) expect { subject }.to change { ErrorTracking::ErrorEvent.count }.by(1)
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -89,10 +89,10 @@ RSpec.describe API::ErrorTracking::Collector do ...@@ -89,10 +89,10 @@ RSpec.describe API::ErrorTracking::Collector do
context 'transaction request type' do context 'transaction request type' do
let(:params) { fixture_file('error_tracking/transaction.txt') } let(:params) { fixture_file('error_tracking/transaction.txt') }
it 'does nothing and returns no content' do it 'does nothing and returns ok' do
expect { subject }.not_to change { ErrorTracking::ErrorEvent.count } expect { subject }.not_to change { ErrorTracking::ErrorEvent.count }
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:ok)
end end
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