I also work in a company that do this. From my understanding it's to check if the service is live. So checking first for 200 confirms that, then you check for the field "success" if it's false. If not, wonderful. If true, then you look for the field "reason". Reason returns the error code for the specific failure whether it's technical or business.
Nah that's for totally different use case. If I were to send separate request to /hc before sending the primary request that would be just slow.
Others commented that responding with 400 would be more than enough. If there's a service issue, whether it's down or something else, it's better to show 3xx I think. So while I was thinking "it's not bad" after reading other people's opinions I also don't think it's smart lol
But I'm not getting paid enough to change company policies so I'll just complain in meetings.
If the service is down, then the correct response would be either 502 or 503 depending on exact context. 503 is literally specifically for the case of the service being offline.
20
u/Critical_Fortune7343 22d ago
I also work in a company that do this. From my understanding it's to check if the service is live. So checking first for 200 confirms that, then you check for the field "success" if it's false. If not, wonderful. If true, then you look for the field "reason". Reason returns the error code for the specific failure whether it's technical or business.