Skip to content

Commit

Permalink
global: add HEAD and OPTIONS verbs to ping
Browse files Browse the repository at this point in the history
* adds HEAD and OPTIONS HTTP verbs to the /ping endpoint as recommended
  in HAProxy documentation
  • Loading branch information
ntarocco committed Oct 7, 2020
1 parent 2b5a2e6 commit 530a2fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion invenio_app/ext.py
Expand Up @@ -69,7 +69,7 @@ def init_app(self, app, **kwargs):
blueprint = Blueprint('invenio_app_ping', __name__)
limiter = self.limiter

@blueprint.route('/ping')
@blueprint.route('/ping', methods=['HEAD', 'OPTIONS', 'GET'])
@limiter.exempt
def ping():
"""Load balancer ping view."""
Expand Down
4 changes: 4 additions & 0 deletions tests/test_app.py
Expand Up @@ -128,6 +128,10 @@ def test_ping_exempt_from_rate_limiting(app_with_no_limiter):
assert res.status_code == 200
res = client.get('/ping')
assert res.status_code == 200
res = client.head('/ping')
assert res.status_code == 200
res = client.options('/ping')
assert res.status_code == 200


def test_requestid(base_app):
Expand Down

0 comments on commit 530a2fc

Please sign in to comment.