Commits

Pior Bastida committed 990ccb9

Enhance HTTP error message when healthcheck is disable by file

Comments (0)

Files changed (2)

pyramid_health/tests.py

         m_exists.assert_called_with('/maintenance/file/test')
 
         self.assertEqual(response.status_int, 503)
+        self.assertIn(b'Healthcheck disabled by config',
+                      response.body)
 
     @mock.patch("os.path.exists")
     def test_get_maintenance_off(self, m_exists):

pyramid_health/views.py

 
     if 'healthcheck.disablefile' in settings:
         if os.path.exists(settings['healthcheck.disablefile']):
-            return HTTPServiceUnavailable()
+            return HTTPServiceUnavailable(
+                explanation='Healthcheck disabled by config')
 
     return Response('OK', content_type='text/plain')