Merge "Fix text/plain mime type with healthcheck endpoint" into stable/xena

This commit is contained in:
Zuul 2023-10-24 14:31:02 +00:00 committed by Gerrit Code Review
commit 3a141a079d
3 changed files with 20 additions and 1 deletions

View File

@ -39,7 +39,7 @@ class RootController(object):
# Run the oslo middleware healthcheck for /healthcheck
@pecan_expose('json')
@pecan_expose(content_type='plain/text')
@pecan_expose(content_type='text/plain')
@pecan_expose(content_type='text/html')
def healthcheck(self): # pylint: disable=inconsistent-return-statements
if CONF.api_settings.healthcheck_enabled:

View File

@ -114,6 +114,20 @@ class TestHealthCheck(base_db_test.OctaviaDBTestBase):
self.assertEqual(200, response.status_code)
self.assertEqual('OK', response.text)
def test_healthcheck_get_text_plain(self):
self.conf.config(group='healthcheck', detailed=False)
response = self._get(self._get_enabled_app(), '/healthcheck',
headers={'Accept': 'text/plain'})
self.assertEqual(200, response.status_code)
self.assertEqual('OK', response.text)
def test_healthcheck_get_text_plain_detailed(self):
self.conf.config(group='healthcheck', detailed=True)
response = self._get(self._get_enabled_app(), '/healthcheck',
headers={'Accept': 'text/plain'})
self.assertEqual(200, response.status_code)
self.assertEqual('OK', response.text)
def test_healthcheck_get_json(self):
self.conf.config(group='healthcheck', detailed=False)
response = self._get(self._get_enabled_app(), '/healthcheck',

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixed the ability to use the 'text/plain' mime type with the healthcheck
endpoint.