summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oslo_middleware/healthcheck/__init__.py1
-rw-r--r--oslo_middleware/tests/test_healthcheck.py8
-rw-r--r--test-requirements.txt1
3 files changed, 10 insertions, 0 deletions
diff --git a/oslo_middleware/healthcheck/__init__.py b/oslo_middleware/healthcheck/__init__.py
index c85e1ac..13985cb 100644
--- a/oslo_middleware/healthcheck/__init__.py
+++ b/oslo_middleware/healthcheck/__init__.py
@@ -558,4 +558,5 @@ Reason
functor = self._accept_to_functor[accept_type]
body, content_type = functor(results, healthy)
return webob.response.Response(status=status, body=body,
+ charset='UTF-8',
content_type=content_type)
diff --git a/oslo_middleware/tests/test_healthcheck.py b/oslo_middleware/tests/test_healthcheck.py
index 793a895..9220ea4 100644
--- a/oslo_middleware/tests/test_healthcheck.py
+++ b/oslo_middleware/tests/test_healthcheck.py
@@ -18,6 +18,7 @@ import time
import mock
from oslo_config import fixture as config
+from oslo_serialization import jsonutils
from oslotest import base as test_base
import requests
import webob.dec
@@ -192,3 +193,10 @@ class HealthcheckTests(test_base.BaseTestCase):
expected_body=b'DISABLED BY FILE',
server_port=81)
self.assertIn('disable_by_files_ports', self.app._backends.names())
+
+ def test_json_response(self):
+ expected_body = jsonutils.dumps({'detailed': False, 'reasons': []},
+ indent=4,
+ sort_keys=True).encode('utf-8')
+ self._do_test(expected_body=expected_body,
+ accept='application/json')
diff --git a/test-requirements.txt b/test-requirements.txt
index fb4395f..45667bb 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -11,3 +11,4 @@ sphinx>=1.6.2 # BSD
testtools>=1.4.0 # MIT
coverage!=4.4,>=4.0 # Apache-2.0
reno!=2.3.1,>=1.8.0 # Apache-2.0
+oslo.serialization>=1.10.0,!=2.19.1 # Apache-2.0