Commit dfb8fcbb authored by Grzegorz Bizon's avatar Grzegorz Bizon

Use API helper to send artifact file through Workhorse

parent 83600e94
...@@ -432,6 +432,10 @@ module API ...@@ -432,6 +432,10 @@ module API
header(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format)) header(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format))
end end
def send_artifacts_entry(build, entry)
header(*Gitlab::Workhorse.send_artifacts_entry(build, entry))
end
# The Grape Error Middleware only has access to env but no params. We workaround this by # The Grape Error Middleware only has access to env but no params. We workaround this by
# defining a method that returns the right value. # defining a method that returns the right value.
def define_params_for_grape_middleware def define_params_for_grape_middleware
......
...@@ -101,7 +101,7 @@ module API ...@@ -101,7 +101,7 @@ module API
entry = build.artifacts_metadata_entry(params[:artifact_path]) entry = build.artifacts_metadata_entry(params[:artifact_path])
not_found! unless entry.exists? not_found! unless entry.exists?
Gitlab::Workhorse.send_artifacts_entry(build, entry) send_artifacts_entry(build, entry)
end end
desc 'Download the artifacts file from a job' do desc 'Download the artifacts file from a job' do
......
...@@ -215,10 +215,9 @@ describe API::Jobs do ...@@ -215,10 +215,9 @@ describe API::Jobs do
get_artifact_file(artifact) get_artifact_file(artifact)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(response.body)
.to include 'Gitlab-Workhorse-Send-Data', 'artifacts-entry'
expect(response.headers) expect(response.headers)
.to include('Content-Type' => 'application/json') .to include('Content-Type' => 'application/json',
'Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
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