diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-08-04 02:09:34 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-08-04 02:09:34 +0000 |
commit | 1f21acb318a75ab09e89c9d927502836801f7701 (patch) | |
tree | 33c1cba9382215b015a883ccbad6ae99eb9c1847 | |
parent | ae8539902e09b9676d55abee27ca5780623a1666 (diff) | |
parent | c3c9891ddd60a1e6af61d7ab149f2f5b4a74227d (diff) | |
download | oslo-middleware-1f21acb318a75ab09e89c9d927502836801f7701.tar.gz |
Merge "Fix exception in json response under py35"
-rw-r--r-- | oslo_middleware/healthcheck/__init__.py | 1 | ||||
-rw-r--r-- | oslo_middleware/tests/test_healthcheck.py | 8 | ||||
-rw-r--r-- | test-requirements.txt | 1 |
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 03bd601..d4344d2 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 |