Sobes.tech
Middle

The interviewer described a system where the response always has 200 and success=false for errors. How do you feel about this?

sobes.tech AI

Answer from AI

Always using HTTP status 200 and indicating success=false in the response body for errors is a controversial approach. On one hand, it simplifies client-side processing, as it always receives 200. On the other hand, it violates HTTP standards, where status codes reflect the result of the request.

Problems with this approach:

  • Clients and proxies may cache or handle responses incorrectly.
  • It is harder to integrate with monitoring and logging tools that rely on HTTP codes.
  • It violates protocol semantics, which can lead to confusion.

It is better to use standard HTTP codes (4xx, 5xx) for errors and include additional information about the reason in the body. If there are special requirements, they should be clearly documented and considered in client logic.

The interviewer described a system where the response… - sobes.tech