{"action":"created","comment":{"url":"https://api.github.com/repos/treasure-data/td-client-java/pulls/comments/48433248","id":48433248,"diff_hunk":"@@ -177,35 +178,42 @@ public void doPostRequest(Request<?> request, String path, Map<String, String> h\n         StringBuilder sbuf = new StringBuilder();\n         sbuf.append(getSchemeHostPort(System.getenv(Config.TD_ENV_API_SERVER))).append(path);\n \n+        URL url = new URL(sbuf.toString());\n+        conn = (HttpURLConnection) url.openConnection();\n+        conn.setRequestMethod(\"POST\");\n+        conn.setReadTimeout(postReadTimeout);\n+\n+        // header\n+        setRequestAuthHeader(request, conn);\n+        if (header != null && !header.isEmpty()) {\n+            for (Map.Entry<String, String> e : header.entrySet()) {\n+                conn.setRequestProperty(e.getKey(), e.getValue());\n+            }\n+        }\n+\n         // parameters\n         if (params != null && !params.isEmpty()) {\n-            sbuf.append(\"?\");\n+            StringBuilder queryParam = new StringBuilder();\n             int paramSize = params.size();\n             Iterator<Map.Entry<String, String>> iter = params.entrySet().iterator();\n             for (int i = 0; i < paramSize; ++i) {\n                 Map.Entry<String, String> e = iter.next();\n-                sbuf.append(e.getKey()).append(\"=\").append(e.getValue());\n+                queryParam.append(e.getKey()).append(\"=\").append(e.getValue());\n                 if (i + 1 != paramSize) {\n-                    sbuf.append(\"&\");\n+                    queryParam.append(\"&\");\n                 }\n             }\n-            URL url = new URL(sbuf.toString());\n-            conn = (HttpURLConnection) url.openConnection();\n+\n+            byte[] bodyData = queryParam.toString().getBytes(\"UTF-8\");\n+            conn.setRequestProperty(\"Content-Type\", \"application/x-www-form-urlencoded\");\n+            conn.setRequestProperty(\"Content-Length\", Integer.toString(bodyData.length));","path":"src/main/java/com/treasure_data/client/HttpConnectionImpl.java","position":45,"original_position":45,"commit_id":"e4b815297a5ddaf1b893c2584f8b93823e996df4","original_commit_id":"e4b815297a5ddaf1b893c2584f8b93823e996df4","user":{"login":"yyuu","id":63651,"avatar_url":"https://avatars.githubusercontent.com/u/63651?v=3","gravatar_id":"","url":"https://api.github.com/users/yyuu","html_url":"https://github.com/yyuu","followers_url":"https://api.github.com/users/yyuu/followers","following_url":"https://api.github.com/users/yyuu/following{/other_user}","gists_url":"https://api.github.com/users/yyuu/gists{/gist_id}","starred_url":"https://api.github.com/users/yyuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyuu/subscriptions","organizations_url":"https://api.github.com/users/yyuu/orgs","repos_url":"https://api.github.com/users/yyuu/repos","events_url":"https://api.github.com/users/yyuu/events{/privacy}","received_events_url":"https://api.github.com/users/yyuu/received_events","type":"User","site_admin":false},"body":"`Content-Length` should be the length of encoded body.","created_at":"2015-12-25T06:26:09Z","updated_at":"2015-12-25T06:26:09Z","html_url":"https://github.com/treasure-data/td-client-java/pull/22#discussion_r48433248","pull_request_url":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/treasure-data/td-client-java/pulls/comments/48433248"},"html":{"href":"https://github.com/treasure-data/td-client-java/pull/22#discussion_r48433248"},"pull_request":{"href":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22","id":54575921,"html_url":"https://github.com/treasure-data/td-client-java/pull/22","diff_url":"https://github.com/treasure-data/td-client-java/pull/22.diff","patch_url":"https://github.com/treasure-data/td-client-java/pull/22.patch","issue_url":"https://api.github.com/repos/treasure-data/td-client-java/issues/22","number":22,"state":"open","locked":false,"title":"Embed query parmeters inside POST request body","user":{"login":"xerial","id":57538,"avatar_url":"https://avatars.githubusercontent.com/u/57538?v=3","gravatar_id":"","url":"https://api.github.com/users/xerial","html_url":"https://github.com/xerial","followers_url":"https://api.github.com/users/xerial/followers","following_url":"https://api.github.com/users/xerial/following{/other_user}","gists_url":"https://api.github.com/users/xerial/gists{/gist_id}","starred_url":"https://api.github.com/users/xerial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xerial/subscriptions","organizations_url":"https://api.github.com/users/xerial/orgs","repos_url":"https://api.github.com/users/xerial/repos","events_url":"https://api.github.com/users/xerial/events{/privacy}","received_events_url":"https://api.github.com/users/xerial/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-25T06:16:14Z","updated_at":"2015-12-25T06:26:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf7ab71c811052027fe1f03a6b590e830bc5a477","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22/commits","review_comments_url":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22/comments","review_comment_url":"https://api.github.com/repos/treasure-data/td-client-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/treasure-data/td-client-java/issues/22/comments","statuses_url":"https://api.github.com/repos/treasure-data/td-client-java/statuses/e4b815297a5ddaf1b893c2584f8b93823e996df4","head":{"label":"treasure-data:0.5.x-post-hotfix","ref":"0.5.x-post-hotfix","sha":"e4b815297a5ddaf1b893c2584f8b93823e996df4","user":{"login":"treasure-data","id":747746,"avatar_url":"https://avatars.githubusercontent.com/u/747746?v=3","gravatar_id":"","url":"https://api.github.com/users/treasure-data","html_url":"https://github.com/treasure-data","followers_url":"https://api.github.com/users/treasure-data/followers","following_url":"https://api.github.com/users/treasure-data/following{/other_user}","gists_url":"https://api.github.com/users/treasure-data/gists{/gist_id}","starred_url":"https://api.github.com/users/treasure-data/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treasure-data/subscriptions","organizations_url":"https://api.github.com/users/treasure-data/orgs","repos_url":"https://api.github.com/users/treasure-data/repos","events_url":"https://api.github.com/users/treasure-data/events{/privacy}","received_events_url":"https://api.github.com/users/treasure-data/received_events","type":"Organization","site_admin":false},"repo":{"id":3625270,"name":"td-client-java","full_name":"treasure-data/td-client-java","owner":{"login":"treasure-data","id":747746,"avatar_url":"https://avatars.githubusercontent.com/u/747746?v=3","gravatar_id":"","url":"https://api.github.com/users/treasure-data","html_url":"https://github.com/treasure-data","followers_url":"https://api.github.com/users/treasure-data/followers","following_url":"https://api.github.com/users/treasure-data/following{/other_user}","gists_url":"https://api.github.com/users/treasure-data/gists{/gist_id}","starred_url":"https://api.github.com/users/treasure-data/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treasure-data/subscriptions","organizations_url":"https://api.github.com/users/treasure-data/orgs","repos_url":"https://api.github.com/users/treasure-data/repos","events_url":"https://api.github.com/users/treasure-data/events{/privacy}","received_events_url":"https://api.github.com/users/treasure-data/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/treasure-data/td-client-java","description":"Java Client Library for Treasure Data","fork":false,"url":"https://api.github.com/repos/treasure-data/td-client-java","forks_url":"https://api.github.com/repos/treasure-data/td-client-java/forks","keys_url":"https://api.github.com/repos/treasure-data/td-client-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/treasure-data/td-client-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/treasure-data/td-client-java/teams","hooks_url":"https://api.github.com/repos/treasure-data/td-client-java/hooks","issue_events_url":"https://api.github.com/repos/treasure-data/td-client-java/issues/events{/number}","events_url":"https://api.github.com/repos/treasure-data/td-client-java/events","assignees_url":"https://api.github.com/repos/treasure-data/td-client-java/assignees{/user}","branches_url":"https://api.github.com/repos/treasure-data/td-client-java/branches{/branch}","tags_url":"https://api.github.com/repos/treasure-data/td-client-java/tags","blobs_url":"https://api.github.com/repos/treasure-data/td-client-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/treasure-data/td-client-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/treasure-data/td-client-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/treasure-data/td-client-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/treasure-data/td-client-java/statuses/{sha}","languages_url":"https://api.github.com/repos/treasure-data/td-client-java/languages","stargazers_url":"https://api.github.com/repos/treasure-data/td-client-java/stargazers","contributors_url":"https://api.github.com/repos/treasure-data/td-client-java/contributors","subscribers_url":"https://api.github.com/repos/treasure-data/td-client-java/subscribers","subscription_url":"https://api.github.com/repos/treasure-data/td-client-java/subscription","commits_url":"https://api.github.com/repos/treasure-data/td-client-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/treasure-data/td-client-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/treasure-data/td-client-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/treasure-data/td-client-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/treasure-data/td-client-java/contents/{+path}","compare_url":"https://api.github.com/repos/treasure-data/td-client-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/treasure-data/td-client-java/merges","archive_url":"https://api.github.com/repos/treasure-data/td-client-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/treasure-data/td-client-java/downloads","issues_url":"https://api.github.com/repos/treasure-data/td-client-java/issues{/number}","pulls_url":"https://api.github.com/repos/treasure-data/td-client-java/pulls{/number}","milestones_url":"https://api.github.com/repos/treasure-data/td-client-java/milestones{/number}","notifications_url":"https://api.github.com/repos/treasure-data/td-client-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/treasure-data/td-client-java/labels{/name}","releases_url":"https://api.github.com/repos/treasure-data/td-client-java/releases{/id}","created_at":"2012-03-05T08:45:22Z","updated_at":"2015-07-30T11:43:21Z","pushed_at":"2015-12-25T06:18:51Z","git_url":"git://github.com/treasure-data/td-client-java.git","ssh_url":"git@github.com:treasure-data/td-client-java.git","clone_url":"https://github.com/treasure-data/td-client-java.git","svn_url":"https://github.com/treasure-data/td-client-java","homepage":"http://docs.treasuredata.com/articles/java","size":1214,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":5,"default_branch":"master"}},"base":{"label":"treasure-data:0.5.x","ref":"0.5.x","sha":"5da47c5e381ab3250db5c1ded62899831c6ec6aa","user":{"login":"treasure-data","id":747746,"avatar_url":"https://avatars.githubusercontent.com/u/747746?v=3","gravatar_id":"","url":"https://api.github.com/users/treasure-data","html_url":"https://github.com/treasure-data","followers_url":"https://api.github.com/users/treasure-data/followers","following_url":"https://api.github.com/users/treasure-data/following{/other_user}","gists_url":"https://api.github.com/users/treasure-data/gists{/gist_id}","starred_url":"https://api.github.com/users/treasure-data/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treasure-data/subscriptions","organizations_url":"https://api.github.com/users/treasure-data/orgs","repos_url":"https://api.github.com/users/treasure-data/repos","events_url":"https://api.github.com/users/treasure-data/events{/privacy}","received_events_url":"https://api.github.com/users/treasure-data/received_events","type":"Organization","site_admin":false},"repo":{"id":3625270,"name":"td-client-java","full_name":"treasure-data/td-client-java","owner":{"login":"treasure-data","id":747746,"avatar_url":"https://avatars.githubusercontent.com/u/747746?v=3","gravatar_id":"","url":"https://api.github.com/users/treasure-data","html_url":"https://github.com/treasure-data","followers_url":"https://api.github.com/users/treasure-data/followers","following_url":"https://api.github.com/users/treasure-data/following{/other_user}","gists_url":"https://api.github.com/users/treasure-data/gists{/gist_id}","starred_url":"https://api.github.com/users/treasure-data/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treasure-data/subscriptions","organizations_url":"https://api.github.com/users/treasure-data/orgs","repos_url":"https://api.github.com/users/treasure-data/repos","events_url":"https://api.github.com/users/treasure-data/events{/privacy}","received_events_url":"https://api.github.com/users/treasure-data/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/treasure-data/td-client-java","description":"Java Client Library for Treasure Data","fork":false,"url":"https://api.github.com/repos/treasure-data/td-client-java","forks_url":"https://api.github.com/repos/treasure-data/td-client-java/forks","keys_url":"https://api.github.com/repos/treasure-data/td-client-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/treasure-data/td-client-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/treasure-data/td-client-java/teams","hooks_url":"https://api.github.com/repos/treasure-data/td-client-java/hooks","issue_events_url":"https://api.github.com/repos/treasure-data/td-client-java/issues/events{/number}","events_url":"https://api.github.com/repos/treasure-data/td-client-java/events","assignees_url":"https://api.github.com/repos/treasure-data/td-client-java/assignees{/user}","branches_url":"https://api.github.com/repos/treasure-data/td-client-java/branches{/branch}","tags_url":"https://api.github.com/repos/treasure-data/td-client-java/tags","blobs_url":"https://api.github.com/repos/treasure-data/td-client-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/treasure-data/td-client-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/treasure-data/td-client-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/treasure-data/td-client-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/treasure-data/td-client-java/statuses/{sha}","languages_url":"https://api.github.com/repos/treasure-data/td-client-java/languages","stargazers_url":"https://api.github.com/repos/treasure-data/td-client-java/stargazers","contributors_url":"https://api.github.com/repos/treasure-data/td-client-java/contributors","subscribers_url":"https://api.github.com/repos/treasure-data/td-client-java/subscribers","subscription_url":"https://api.github.com/repos/treasure-data/td-client-java/subscription","commits_url":"https://api.github.com/repos/treasure-data/td-client-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/treasure-data/td-client-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/treasure-data/td-client-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/treasure-data/td-client-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/treasure-data/td-client-java/contents/{+path}","compare_url":"https://api.github.com/repos/treasure-data/td-client-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/treasure-data/td-client-java/merges","archive_url":"https://api.github.com/repos/treasure-data/td-client-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/treasure-data/td-client-java/downloads","issues_url":"https://api.github.com/repos/treasure-data/td-client-java/issues{/number}","pulls_url":"https://api.github.com/repos/treasure-data/td-client-java/pulls{/number}","milestones_url":"https://api.github.com/repos/treasure-data/td-client-java/milestones{/number}","notifications_url":"https://api.github.com/repos/treasure-data/td-client-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/treasure-data/td-client-java/labels{/name}","releases_url":"https://api.github.com/repos/treasure-data/td-client-java/releases{/id}","created_at":"2012-03-05T08:45:22Z","updated_at":"2015-07-30T11:43:21Z","pushed_at":"2015-12-25T06:18:51Z","git_url":"git://github.com/treasure-data/td-client-java.git","ssh_url":"git@github.com:treasure-data/td-client-java.git","clone_url":"https://github.com/treasure-data/td-client-java.git","svn_url":"https://github.com/treasure-data/td-client-java","homepage":"http://docs.treasuredata.com/articles/java","size":1214,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22"},"html":{"href":"https://github.com/treasure-data/td-client-java/pull/22"},"issue":{"href":"https://api.github.com/repos/treasure-data/td-client-java/issues/22"},"comments":{"href":"https://api.github.com/repos/treasure-data/td-client-java/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/treasure-data/td-client-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/treasure-data/td-client-java/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/treasure-data/td-client-java/statuses/e4b815297a5ddaf1b893c2584f8b93823e996df4"}}}}