team-genny / genny

0 stars 1 forks source link

Fix invalid query params for /api/data produce 500 error #24

Closed fergcb closed 4 months ago

fergcb commented 4 months ago

When sending invalid query params to the GET /api/data endpoint, the error response is a 500 status code, not 4XX, suggesting that there is some kind of internal server error, rather than an error validating the params.

If the query params are invalid, the endpoint should return 400 Bad Request, along with a response body like so:

{
  "error": "<error message>",
  "details": {
    // Optional details
  }
}