Closed JanC closed 6 years ago
I agree. I’ll go through the API and find these error responses. However, I think the error code should be 400 in this case because the endpoint exists but the error arose because of client-supplied info.
The full range of status code pass throughs was a little more than expected, but https://github.com/flyinactor91/AVWX-API/commit/d7547f78a2082c33b42ca0babbc02264300082e3 should handle all of these cases for API endpoints. It also let me change if 'Error' in data:
to if code != 200:
which is more flexible.
thanks!
When supplying a invalid station icao code, the returned error is still 500 though:
curl http://localhost:8000/api/metar/ABC | jq
{
"message": "Internal Server Error"
}
Hi, when a client submits a non-existing icao code, the API returns correctly an error message
but the HTTP code is 200.
I believe the
api.py
should handle this and return an appropriate error code to the client. In theif error:
case:https://github.com/flyinactor91/AVWX-API/blob/bed76e4960d46420d2fdcfe424fa814182c2760c/avwx_api/api.py#L82-L92
maybe simply: