Merge pull request #2992 from ajgon/feature/healthcheck

add healthcheck endpoint to aid service discovery tools
This commit is contained in:
Noémi Ványi 2021-10-03 11:39:32 +02:00 committed by GitHub
commit 49b2553561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -584,6 +584,11 @@ def index():
)
@app.route('/healthz', methods=['GET'])
def health():
return Response('OK', mimetype='text/plain')
@app.route('/search', methods=['GET', 'POST'])
def search():
"""Search query in q and return results.

View File

@ -188,6 +188,11 @@ class ViewsTestCase(SearxTestCase):
self.assertEqual(result.status_code, 200)
self.assertIn(b'<h1>About <a href="/">searx</a></h1>', result.data)
def test_health(self):
result = self.app.get('/healthz')
self.assertEqual(result.status_code, 200)
self.assertIn(b'OK', result.data)
def test_preferences(self):
result = self.app.get('/preferences')
self.assertEqual(result.status_code, 200)