diff options
-rw-r--r-- | lib/container_registry/client.rb | 10 | ||||
-rw-r--r-- | spec/lib/container_registry/repository_spec.rb | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/container_registry/client.rb b/lib/container_registry/client.rb index e0b3f14d384..b222be0475e 100644 --- a/lib/container_registry/client.rb +++ b/lib/container_registry/client.rb @@ -15,11 +15,13 @@ module ContainerRegistry end def repository_tags(name) - @faraday.get("/v2/#{name}/tags/list").body + response = @faraday.get("/v2/#{name}/tags/list") + response.body if response.success? end def repository_manifest(name, reference) - @faraday.get("/v2/#{name}/manifests/#{reference}").body + response = @faraday.get("/v2/#{name}/manifests/#{reference}") + response.body if response.success? end def repository_tag_digest(name, reference) @@ -34,7 +36,8 @@ module ContainerRegistry def blob(name, digest, type = nil) headers = {} headers['Accept'] = type if type - @faraday.get("/v2/#{name}/blobs/#{digest}", nil, headers).body + response = @faraday.get("/v2/#{name}/blobs/#{digest}", nil, headers) + response.body if response.success? end def delete_blob(name, digest) @@ -47,6 +50,7 @@ module ContainerRegistry conn.request :json conn.headers['Accept'] = MANIFEST_VERSION + conn.response :json, content_type: 'application/json' conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v1+prettyjws' conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v1+json' conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v2+json' diff --git a/spec/lib/container_registry/repository_spec.rb b/spec/lib/container_registry/repository_spec.rb index 279709521c9..c364e759108 100644 --- a/spec/lib/container_registry/repository_spec.rb +++ b/spec/lib/container_registry/repository_spec.rb @@ -21,7 +21,7 @@ describe ContainerRegistry::Repository do to_return( status: 200, body: JSON.dump(tags: ['test']), - headers: { 'Content-Type' => 'application/vnd.docker.distribution.manifest.v2+json' }) + headers: { 'Content-Type' => 'application/json' }) end context '#manifest' do |