i3wangyi commented on a change in pull request #367: Add transient cache for CustomRestClient implementation URL: https://github.com/apache/helix/pull/367#discussion_r309857682
########## File path: helix-rest/src/main/java/org/apache/helix/rest/client/CustomRestClientImpl.java ########## @@ -122,18 +146,23 @@ protected JsonNode getJsonObject(HttpResponse httpResponse) throws IOException { @VisibleForTesting protected HttpResponse post(String url, Map<String, String> payloads) throws IOException { + HttpPost postRequest = new HttpPost(url); + postRequest.setHeader("Accept", ACCEPT_CONTENT_TYPE); + StringEntity entity = new StringEntity(OBJECT_MAPPER.writeValueAsString(payloads), ContentType.APPLICATION_JSON); + postRequest.setEntity(entity); + HttpResponse httpResponse; + int hashCode = url.hashCode() + payloads.hashCode(); Review comment: Yes, the hashCode doesn't prevent the trick conditions. The implementation is based on our prior knowledge about the incoming parameter (baseUrl + custom) and it won't cause any conflictions. Another reason is the `HttpRequest` class in Java library, it doesn't handle `equals` and `hashCode` function very well, the same baseUrl ends up different by the computation. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services