diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:46 +0300 |
commit | 221b529789f4090341a825695aeb49b8df6dd11d (patch) | |
tree | c8843e4ca5ef1034752eb68712fcf338b24950db /lib/container_registry | |
parent | 00a8c64ffd18e74df4b1cdeda7776b5221fddafe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/container_registry')
-rw-r--r-- | lib/container_registry/client.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/container_registry/client.rb b/lib/container_registry/client.rb index 12f7f04634f..56f556c229a 100644 --- a/lib/container_registry/client.rb +++ b/lib/container_registry/client.rb @@ -159,13 +159,13 @@ module ContainerRegistry end def faraday - @faraday ||= Faraday.new(@base_uri) do |conn| + @faraday ||= faraday_base do |conn| initialize_connection(conn, @options, &method(:accept_manifest)) end end def faraday_blob - @faraday_blob ||= Faraday.new(@base_uri) do |conn| + @faraday_blob ||= faraday_base do |conn| initialize_connection(conn, @options) end end @@ -173,12 +173,16 @@ module ContainerRegistry # Create a new request to make sure the Authorization header is not inserted # via the Faraday middleware def faraday_redirect - @faraday_redirect ||= Faraday.new(@base_uri) do |conn| + @faraday_redirect ||= faraday_base do |conn| conn.request :json conn.adapter :net_http end end + def faraday_base(&block) + Faraday.new(@base_uri, headers: { user_agent: "GitLab/#{Gitlab::VERSION}" }, &block) + end + def delete_if_exists(path) result = faraday.delete(path) |