Is front-end supposed to handle response with different json format under the same status code?
Or it's back-end's job to separate them into different status code?
I'm asking this because I'm now provided with a restful api which have different json response under status code 200.
e.g.
First one:
{
"status": "error",
"msg": "have no user data",
"inputs": {
"id": "thisisafaketestid"
}
}
Second one:
{
"status": "success",
"user": {
"id": 1,
"name": "somename",
"email": "someEmail@gmail.com"
}
}
And the status code of both requests are 200.