From 9d0f7a53571173ea401579202cc5d54debdd90c3 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Tue, 13 Jun 2017 16:03:38 +0000 Subject: [PATCH] Ensure HEAD is supported with simple cert This changes makes it so simple cert GET requests also support HEAD. Change-Id: Id930c783a7adf96e3a3bf41b527df83735c9fbd5 Partial-Bug: 1696574 --- keystone/tests/unit/test_contrib_simple_cert.py | 6 ++++++ keystone/token/_simple_cert.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/keystone/tests/unit/test_contrib_simple_cert.py b/keystone/tests/unit/test_contrib_simple_cert.py index 111aa5c66b..b9e750f0c0 100644 --- a/keystone/tests/unit/test_contrib_simple_cert.py +++ b/keystone/tests/unit/test_contrib_simple_cert.py @@ -36,6 +36,12 @@ class TestSimpleCert(BaseTestCase): self.assertEqual(content_type, response.content_type.lower()) self.assertIn(b'---BEGIN', response.body) + # Test the same path with HEAD + self.request( + app=self.public_app, method='HEAD', path=path, + headers={'Accept': content_type}, expected_status=http_client.OK + ) + return response def test_ca_cert(self): diff --git a/keystone/token/_simple_cert.py b/keystone/token/_simple_cert.py index 6cc4128a62..301ea383cd 100644 --- a/keystone/token/_simple_cert.py +++ b/keystone/token/_simple_cert.py @@ -60,12 +60,12 @@ class Routers(wsgi.RoutersBase): self._add_resource( mapper, controller, path=self._construct_url('ca'), - get_action='get_ca_certificate', + get_head_action='get_ca_certificate', rel=build_resource_relation(resource_name='ca_certificate')) self._add_resource( mapper, controller, path=self._construct_url('certificates'), - get_action='list_certificates', + get_head_action='list_certificates', rel=build_resource_relation(resource_name='certificates'))