Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

healthcheck endpoint

Igor Rzegocki13c355c4c45d
diff --git a/searx/webapp.py b/searx/webapp.py
index ee558a5f7..98480e4b6 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -618,6 +618,11 @@ def index():
)
[email protected]('/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.
diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py
index ff58aa1e9..cfaa4fb90 100644
--- a/tests/unit/test_webapp.py
+++ b/tests/unit/test_webapp.py
@@ -191,6 +191,11 @@ class ViewsTestCase(SearxTestCase):
self.assertEqual(result.status_code, 200)
self.assertIn(b'<h1>About <a href="/">searxng</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)