Skip to content

Commit

Permalink
Fix accept header for tag retrieval
Browse files Browse the repository at this point in the history
 - Change it to `application/json`
  • Loading branch information
ilayaperumalg committed Nov 20, 2020
1 parent 38307eb commit f6044fa
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,11 @@ public Map<String, ContainerRegistryConfiguration> getContainerRegistryConfigura
public List<String> getTags(String registryName, String repositoryName) {
try {
ContainerRegistryConfiguration containerRegistryConfiguration = this.registryConfigurations.get(registryName);
String imageManifestMediaType = containerRegistryConfiguration.getManifestMediaType();
if (!SUPPORTED_MANIFEST_MEDIA_TYPES.contains(imageManifestMediaType)) {
throw new ContainerRegistryException("Not supported image manifest media type:" + imageManifestMediaType);
}
Map<String, String> properties = new HashMap<>();
properties.put(DockerOAuth2RegistryAuthorizer.DOCKER_REGISTRY_REPOSITORY_FIELD_KEY, repositoryName);
HttpHeaders httpHeaders = new HttpHeaders(this.registryAuthorizerMap.get(containerRegistryConfiguration.getAuthorizationType()).getAuthorizationHeaders(
containerRegistryConfiguration, properties));
httpHeaders.set(HttpHeaders.ACCEPT, imageManifestMediaType);
httpHeaders.set(HttpHeaders.ACCEPT, "application/json");

UriComponents manifestUriComponents = UriComponentsBuilder.newInstance()
.scheme(HTTPS_SCHEME)
Expand Down Expand Up @@ -138,19 +134,12 @@ public Map getRepositories(String registryName) {
try {
ContainerRegistryConfiguration containerRegistryConfiguration = this.registryConfigurations
.get(registryName);
String imageManifestMediaType = containerRegistryConfiguration.getManifestMediaType();
if (!SUPPORTED_MANIFEST_MEDIA_TYPES.contains(imageManifestMediaType)) {
throw new ContainerRegistryException(
"Not supported image manifest media type:" + imageManifestMediaType);
}

Map<String, String> properties = new HashMap<>();
properties.put(DockerOAuth2RegistryAuthorizer.DOCKER_REGISTRY_REPOSITORY_FIELD_KEY, registryName);
HttpHeaders httpHeaders = new HttpHeaders(
this.registryAuthorizerMap.get(containerRegistryConfiguration.getAuthorizationType())
.getAuthorizationHeaders(
containerRegistryConfiguration, properties));
httpHeaders.set(HttpHeaders.ACCEPT, imageManifestMediaType);

UriComponents manifestUriComponents = UriComponentsBuilder.newInstance()
.scheme(HTTPS_SCHEME)
Expand Down

0 comments on commit f6044fa

Please sign in to comment.