Is your feature request related to a problem? Please describe.
Currently, all character and episode endpoints just return the character
/episode
json or an array
of the character
/episodes
that match the request.
Describe the solution you'd like
I think that all correct responses should have one of the following formats:
{
"status": 200,
"data": {}
}
or
{
"status": 200,
"results": [],
}
Of course, the response status
should match the correct status of the response. If we changed to doing this, though, then it would allow us to include errors in incorrect responses that doesn't look weird. For example, if I were getting data from a certain character, but I sent the request to /character/9999
, we only get a 502 Bad Gateway message. We should, however, return the following data:
{
"status": 404,
"message": "The character you have requested was not found."
}
Edit: the message
property could be swapped for error
.
Using statuses instead of errors allows an easier debugging process, as the developer can access the message and status that the servers sent.
I will work on a PR if this is deemed as needed by the community.