Commit 31bbacf7 authored by Alan Paruszewski's avatar Alan Paruszewski

Set 202 status for running Vulnerability Exports

parent 666755d6
---
title: Return 202 Accepted status code when fetching incompleted Vulnerability Export
from API
merge_request: 28314
author:
type: changed
......@@ -55,7 +55,10 @@ module API
get ':id/vulnerability_exports/:export_id' do
authorize! :read_vulnerability_export, vulnerability_export
::Gitlab::PollingInterval.set_api_header(self, interval: 5_000) unless vulnerability_export.completed?
unless vulnerability_export.completed?
::Gitlab::PollingInterval.set_api_header(self, interval: 5_000)
status :accepted
end
present vulnerability_export,
with: EE::API::Entities::VulnerabilityExport
......
......@@ -105,7 +105,7 @@ describe API::VulnerabilityExports do
it 'returns information about vulnerability export' do
get_vulnerability_export
expect(response).to have_gitlab_http_status(:ok)
expect(response).to have_gitlab_http_status(:accepted)
expect(response).to match_response_schema('public_api/v4/vulnerability_export', dir: 'ee')
expect(json_response['id']).to eq vulnerability_export.id
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