Open mfornasa opened 6 years ago
To me, the option seems to imply that the whole response should be returned regardless of the response code when the check fails. Currently it looks like this setting only returns the body if the status != 2xx. I don't know if this is an old issue that's still valid or not, so I don't mean to hijack it, but I would like to also have this option include the body not only on when we get a non 2xx response, but also if the expected key is not found, or does not meet one of the conditions specified.
@majormoses Would you be open to a PR that updates how this option works to include the response on other failures as well?
Man that check is a mess, I guess that's what happens when you try to implement curl
and every monitoring use case around it without proper design.
Based on the description of the check option I would assume that it should print the body when status != "ok"
meaning for warning
, critical
, or unknown
statuses which has nothing to do with status codes. The function that generates it should always return the whole body put that does not mean it is printed until the status is evaluated.
I think there are use cases to assert that something intentionally does not exist, that something redirects, etc which would be a non 200 response which leads me to think that this should be a per status configurable setting.
-w
prints HTTP body even if the check is successful.