Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ping should return valid JSON for 200 status code #174

Open
cancan101 opened this issue Mar 23, 2018 · 3 comments
Open

Ping should return valid JSON for 200 status code #174

cancan101 opened this issue Mar 23, 2018 · 3 comments

Comments

@cancan101
Copy link
Contributor

Given we return 200 status code rather than 204 (no content), we should return valid json. eg. {} or {'status': 'ok'} Maybe take the return values as kwarg and default to empty dict?

def add_ping(self, rule, status_code=200, app=None):
"""Add a ping route.
:param str rule: The URL rule. This will not use the API prefix, as the
ping endpoint is not really part of the API.
:param int status_code: The ping response status code. The default is
200 rather than the more correct 204 because many health checks
look for 200s.
:param app: If specified, the application to which to add the route.
Otherwise, this will be the bound application, if present.
"""
app = self._get_app(app)
@app.route(rule)
def ping():
return '', status_code

@itajaja
Copy link
Member

itajaja commented Mar 23, 2018

true, but I'd rather return 204 then, unless there is a specific reason for returning a payload?

@cancan101
Copy link
Contributor Author

204 seems fine but 1. Confirm elb now allows specifying return code (I believe it does). 2. Be aware that this will be an unexpected breaking change for anyone using it and expecting a 200 (eg current elb users that haven't set 204 as acceptable).

@itajaja
Copy link
Member

itajaja commented Mar 23, 2018

fair points :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants