API Design · Junior · Question 17 of 75
Why is returning 200 OK with { "error": "not found" } a bad practice?
- 1JSON can't contain the word error
- ✓Correct answer: HTTP clients, caches, proxies and monitoring rely on status codes; hiding errors in a 200 breaks retries, caching and alerting
- 3It makes the response too large
Explanation
Use the right status code and a consistent error body.