desaikomal commented on code in PR #2532:
URL: https://github.com/apache/helix/pull/2532#discussion_r1232941199
##########
helix-rest/src/test/java/org/apache/helix/rest/client/TestCustomRestClient.java:
##########
@@ -158,11 +158,13 @@ public void testPostRequestFormat() throws IOException {
final String echoServer = "http://httpbin.org/post";
CustomRestClientImpl customRestClient = new
CustomRestClientImpl(HttpClients.createDefault());
HttpResponse response = customRestClient.post(echoServer,
Collections.emptyMap());
- JsonNode json = customRestClient.getJsonObject(response);
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+ JsonNode json = customRestClient.getJsonObject(response);
- Assert.assertEquals(response.getStatusLine().getStatusCode(),
HttpStatus.SC_OK);
- Assert.assertEquals(json.get("headers").get("Accept").asText(),
"application/json");
- Assert.assertEquals(json.get("data").asText(), "{}");
+ Assert.assertEquals(response.getStatusLine().getStatusCode(),
HttpStatus.SC_OK);
Review Comment:
true, it is redundant. I was wondering if there is a better way to detect if
the endpoint is accessible? i couldn't find any other way. do you have any
suggestion?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]