4 ms·
Don't agree with "Business logic and HTTP status codes" tbh, because now i have to work with apis that do this: Statuscode: 200 { success: false, error: "..."
by shreddit 1y ago
Don't agree with "Business logic and HTTP status codes" tbh, because now i have to work with apis that do this:
Statuscode: 200
{ success: false, error: "..." }
- Culonavirus 1y agoI don't really care either way, it's not a big issue to me, but I can see why people might do that. I mean what if an api endpoint returns a 403 when the end user doesn't have access to that resource, but also 403 because you, the consumer/app doesn't have access to the "server" the api is running on? HTTP codes were originally intended as server status codes, not server application status codes. At least with 200 you know your request was processed on the server successfully.
- Izkata 1y agoAlso, apache ignores the content body and returns an empty string with several classes of error codes, so using 200 is the only reliable way when you want to get that custom error message to the user.