Hacker News new | ask | show | jobs
by treis 1438 days ago
>Which is not to say you are wrong if you return a 400

5XX - Server did something wrong

4XX - Client system did something wrong

2XX - Everything worked

IMHO, what's missing is a code for "All systems worked but the user did something wrong" for scenarios like looking up a non existent ID or if their CC details don't work.

1 comments

I've always interpreted 422 to fit this case: a well-formed request that cannot be processed due to the content in the payload.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422

Unfortunately, literal reading of 422 implies that the sent content has error(s) and not the header. It's close, but I still feel that for GET requests it's wrong.