mirror of
https://github.com/ilyakooo0/searx.git
synced 2024-12-02 01:14:39 +03:00
Merge pull request #2992 from ajgon/feature/healthcheck
add healthcheck endpoint to aid service discovery tools
This commit is contained in:
commit
49b2553561
@ -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'])
|
@app.route('/search', methods=['GET', 'POST'])
|
||||||
def search():
|
def search():
|
||||||
"""Search query in q and return results.
|
"""Search query in q and return results.
|
||||||
|
@ -188,6 +188,11 @@ class ViewsTestCase(SearxTestCase):
|
|||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assertIn(b'<h1>About <a href="/">searx</a></h1>', result.data)
|
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):
|
def test_preferences(self):
|
||||||
result = self.app.get('/preferences')
|
result = self.app.get('/preferences')
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
Loading…
Reference in New Issue
Block a user