3 ms·
400 you screwed up vs 500 I screwed up is always better than 200 OK not really. You can get more specific, and for REST style APIs the correct specific HTTP st
by dragonwriter 3y ago
400 you screwed up vs 500 I screwed up is always better than 200 OK not really.
You can get more specific, and for REST style APIs the correct specific HTTP status code is usually apparent for both successful and unsuccessful requests, but 2xx/4xx/5xx is simple and should be trivial to determine for anything you are using HTTP for even if it's not REST-like.
- jerf 3y agoI do tend to use those in exactly that way, yes. However, while your mileage may vary, I end up getting the same complaint from the users either way. Even when my 400 contains an exact reason why the input is incorrect. Granted, on the one hand, this can be fixed on the individual level, but on the other hand, it's the same effect writ small that when writ large makes the response codes nearly useless, so this post is maybe half cathartic grousing. I can't push caring about response codes. I can document it, I can yield detailed errors, and I can be as careful as I like, but this is a "it takes two to tango" situation and at scale, on average, the other end doesn't want to tango.