Commit cce625d2 authored by David Kim's avatar David Kim

Merge branch '323920-artifacts-object-storage' into 'master'

Replace Excon with Faraday for requesting object storage

See merge request gitlab-org/gitlab!64192
parents 3d9b36b8 516a27be
...@@ -283,8 +283,9 @@ module ObjectStorage ...@@ -283,8 +283,9 @@ module ObjectStorage
if file_storage? if file_storage?
IO.copy_stream(path, file) IO.copy_stream(path, file)
else else
streamer = lambda { |chunk, _, _| file.write(chunk) } Faraday.get(url) do |req|
Excon.get(url, response_block: streamer) req.options.on_data = proc { |chunk, _| file.write(chunk) }
end
end end
file.seek(0, IO::SEEK_SET) file.seek(0, IO::SEEK_SET)
......
...@@ -222,7 +222,11 @@ RSpec.describe ObjectStorage do ...@@ -222,7 +222,11 @@ RSpec.describe ObjectStorage do
before do before do
stub_artifacts_object_storage stub_artifacts_object_storage
stub_request(:get, %r{s3.amazonaws.com/#{uploader.path}}).to_return(status: 200, body: '')
# We need to check the Host header not including the port because AWS does not accept
stub_request(:get, %r{s3.amazonaws.com/#{uploader.path}})
.with { |request| !request.headers['Host'].to_s.include?(':443') }
.to_return(status: 200, body: '')
end end
it "returns the file" do it "returns the file" do
......
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