From 49110854cb5f036f986613d7ebe7e6150f5e650f Mon Sep 17 00:00:00 2001 From: Ina Panova Date: Wed, 2 Oct 2019 13:35:56 +0200 Subject: [PATCH] Docker-Distribution-API-Version should be present among response headers. closes #5527 https://pulp.plan.io/issues/5527 --- CHANGES/5527.bugfix | 1 + pulp_docker/app/registry.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 CHANGES/5527.bugfix diff --git a/CHANGES/5527.bugfix b/CHANGES/5527.bugfix new file mode 100644 index 00000000..61afd031 --- /dev/null +++ b/CHANGES/5527.bugfix @@ -0,0 +1 @@ +Add Docker-Distribution-API-Version header among response headers. diff --git a/pulp_docker/app/registry.py b/pulp_docker/app/registry.py index b6bd00da..d8f13e72 100644 --- a/pulp_docker/app/registry.py +++ b/pulp_docker/app/registry.py @@ -14,6 +14,9 @@ log = logging.getLogger(__name__) +v2_headers = MultiDict() +v2_headers['Docker-Distribution-API-Version'] = 'registry/2.0' + class ArtifactNotFound(Exception): """ @@ -96,7 +99,7 @@ async def serve_v2(request): The docker client uses this endpoint to discover that the V2 API is available. """ - return web.json_response({}) + return web.json_response({}, headers=v2_headers) async def tags_list(self, request): """ @@ -111,7 +114,7 @@ async def tags_list(self, request): if isinstance(c, Tag): tags['tags'].add(c.name) tags['tags'] = list(tags['tags']) - return web.json_response(tags) + return web.json_response(tags, headers=v2_headers) async def get_tag(self, request): """