Skip to content

Commit

Permalink
We should enforce these required inputs by returning a useful error a…
Browse files Browse the repository at this point in the history
…nd 400 response. right now it is 500
  • Loading branch information
autata committed Feb 22, 2024
1 parent 172f0b3 commit ac76564
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,20 @@ private static String getQueryString(JsonNode body) {
return queryString;
}

// This is required. consider returning a more useful error to the user than 500
// or setting a reasonable default (default seems a good option here)
private static int getHowMany(JsonNode body) {
return body.get("size").asInt();
}

// This is required. consider returning a more useful error to the user than 500
// or setting a reasonable default (not sure what that would be)
private static long getStartTimeEpochMs(JsonNode body) {
return body.get("query").findValue("gte").asLong();
}

// This is required. consider returning a more useful error to the user than 500
// or setting a reasonable default (not sure what that would be)
private static long getEndTimeEpochMs(JsonNode body) {
return body.get("query").findValue("lte").asLong();
}
Expand Down

0 comments on commit ac76564

Please sign in to comment.