From da32f8092a1ae038046864a4edc6e448b9e1b811 Mon Sep 17 00:00:00 2001 From: Luis Helder Date: Thu, 22 Aug 2024 17:51:03 -0300 Subject: [PATCH] fix: Healthcheck content-type (#1110) --- hathor/healthcheck/resources/healthcheck.py | 1 + tests/resources/healthcheck/test_healthcheck.py | 1 + 2 files changed, 2 insertions(+) diff --git a/hathor/healthcheck/resources/healthcheck.py b/hathor/healthcheck/resources/healthcheck.py index eb1de7eed..bcc872e4f 100644 --- a/hathor/healthcheck/resources/healthcheck.py +++ b/hathor/healthcheck/resources/healthcheck.py @@ -53,6 +53,7 @@ def _render_success(self, result: HealthcheckResponse, request: Request) -> None status_code = result.get_http_status_code() request.setResponseCode(status_code) + request.setHeader(b'content-type', b'application/json; charset=utf-8') request.write(json_dumpb(result.to_json())) request.finish() diff --git a/tests/resources/healthcheck/test_healthcheck.py b/tests/resources/healthcheck/test_healthcheck.py index 5beff1f24..c857e5877 100644 --- a/tests/resources/healthcheck/test_healthcheck.py +++ b/tests/resources/healthcheck/test_healthcheck.py @@ -191,6 +191,7 @@ def test_get_ready(self): response = yield self.web.get('/health') data = response.json_value() + self.assertTrue('application/json; charset=utf-8' in response.responseHeaders.getRawHeaders('content-type')) self.assertEqual(response.responseCode, 200) self.assertEqual(data, { 'status': 'pass',