From e8e0f87c508cbfb5f98820d680d7fbcc99926183 Mon Sep 17 00:00:00 2001 From: oohira Date: Sat, 18 Jul 2015 22:18:50 +0900 Subject: [PATCH] Don't set Content-Length property explicitly. Previous code had a bug to set whole request contents instead of the length. In addition, HttpURLConnection.setRequestProperty() doesn't allow to set Content-Length because it is automatically set in the library. --- src/main/java/com/github/oohira/intercom/Intercom.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/oohira/intercom/Intercom.java b/src/main/java/com/github/oohira/intercom/Intercom.java index 1bf593d..5719997 100644 --- a/src/main/java/com/github/oohira/intercom/Intercom.java +++ b/src/main/java/com/github/oohira/intercom/Intercom.java @@ -534,7 +534,7 @@ private String send(final String url, final String method, final String body) th if (method.equals("POST") || method.equals("PUT") || method.equals("DELETE")) { http.setDoOutput(true); http.setRequestProperty("Content-Type", "application/json"); - http.setRequestProperty("Content-Length", String.valueOf(body)); + //NOTE: Content-Length is automatically set by Java HTTP library. } http.connect();