4 ms·
> should I return 200 OK and error message as a JSON or return 40x HTTP code? Anyone who returns a 200 OK on error is, of course, in a state of sin. You’re we
by eadmund 4y ago
> should I return 200 OK and error message as a JSON or return 40x HTTP code?
Anyone who returns a 200 OK on error is, of course, in a state of sin.
You’re welcome to return a 4xx + JSON, if that is congruent with the client’s Accept header.
Yes, I’m aware that GraphQL uses 200 OK for errors. That is only one of the reasons that it GraphQL is unfit for purpose. Frankly it is embarrassing that it has become popular. It’s like a clown car at a funeral.