-
Notifications
You must be signed in to change notification settings - Fork 918
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
/healthz endpoint accepts JSON now #5558
Conversation
w.WriteHeader(http.StatusOK) | ||
} | ||
|
||
switch negotiateContentType(r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the header is unset, as it usually is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then negotiateContentType()
defaults to text/plain
(and this is covered by unit test). So, whenever nothing is specified, we basically have the previous functionality, if "Accept:" header is provided, then we parse and use it.
Resolves #5546
/healthz
to accept JSON as preferred output.text/plain
context type is used, however, when JSON is accepted as response (that's whenAccept: application/json, */*;q=0.5
header is sent), output is JSON:200 OK
is valid code). Each individual service has status field (both in plain and JSON output), as well as error message, so individual services can be checked./healthz
endpoint is extended (while code was written in a way that it shouldn't be to hard to extend/metrics
and/goroutinez
endpoints as well)