Skip to content

Commit

Permalink
Merge pull request #755 from VinnyQ/empty_array_ingest_payload_should…
Browse files Browse the repository at this point in the history
…_error

change response to BAD_REQUEST for empty aggregated metrics request
  • Loading branch information
VinnyQ committed Nov 23, 2016
2 parents 3a8c7ee + 56e33eb commit 619bf30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void handle(ChannelHandlerContext ctx, FullHttpRequest request) {

} else {
// no aggregated metric bundles in body, response OK
DefaultHandler.sendResponse(ctx, request, null, HttpResponseStatus.OK);
DefaultHandler.sendResponse(ctx, request, "No valid metrics", HttpResponseStatus.BAD_REQUEST);
return;
}
} catch (JsonParseException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ public void testEmptyArrayJsonRequest() throws IOException {

String responseBody = argument.getValue().content().toString(Charset.defaultCharset());

assertEquals("Invalid response", "", responseBody);
assertEquals("Invalid status", HttpResponseStatus.OK, argument.getValue().getStatus());
assertEquals("Invalid response", "No valid metrics", responseBody);
assertEquals("Invalid status", HttpResponseStatus.BAD_REQUEST, argument.getValue().getStatus());
}

private String createRequestBody(String tenantId, long collectionTime, long flushInterval, BluefloodGauge[] gauges,
Expand Down

0 comments on commit 619bf30

Please sign in to comment.