{"action":"created","issue":{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/234","labels_url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/234/comments","events_url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/234/events","html_url":"https://github.com/chrsmith/google-api-java-client/issues/234","id":59360427,"number":234,"title":"zero length error when content payload is empty","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-28T21:55:22Z","updated_at":"2015-02-28T21:55:23Z","closed_at":null,"body":"```\nVersion of google-api-java-client: 1.4.1-beta\n\nJava environment: observed on Java 6\n\nDescription:\n\nI send a basic authentication header with my HTTP POST request, and when there \nis a content payload, everything works fine. However, there is one circumstance \nwhere there is no actual content payload, and 1.4.1-beta is causing a \n\"content-length is zero\" error to occur when the request is sent. This worked \nfine with 1.3.x, but the way I used to send these requests has been deprecated, \nso I'm trying to do it the 1.4.x way.\n\nHow would you expect it to be fixed?\n\nMy current solution is to send useless data with these requests, which causes \nthe content-length error to go away, but is just covering up either a bug in \nthe API or my own misuse of the API.\n\nWhen someone needs to send a POST request, without content, but with a basic \nauth header, there should not be a \"content-length is zero\" error.\n\nHere's how I call the API:\n\nprivate static HttpRequestFactory createRequestFactory() {\n  return (new NetHttpTransport()).createRequestFactory(\n    new HttpRequestInitializer() {\n      public void initialize(final HttpRequest request) \n        throws IOException {\n          request.headers.setBasicAuthentication(username, password);\n          final JsonHttpParser parser = new JsonHttpParser();\n          parser.jsonFactory = new JacksonFactory();\n          request.addParser(parser);\n      }\n    });\n  }\n\npublic void myFunction() {\n  // use FORM POST encoding\n\n  final UrlEncodedContent content = new UrlEncodedContent();\n  content.data = requestData;\n\t    \n  // create POST request\n\t    \n  final HttpRequest httpRequest = requestFactory.buildPostRequest(\n    new GenericUrl(requestUrl), null);\n\n  // parse return data\n\t\t\n  return httpRequest.execute().parseAs(ExpectedResponseData.class);\n}\n\nThe relevant stacktrace is:\n\ncom.google.api.client.http.HttpResponseException: 411 Length required\n\tat com.google.api.client.http.HttpRequest.execute(HttpRequest.java:380)\n...\n\n\n```\n\nOriginal issue reported on code.google.com by `tra...@circutus.com` on 16 Jun 2011 at 7:58"},"comment":{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/comments/76549036","html_url":"https://github.com/chrsmith/google-api-java-client/issues/234#issuecomment-76549036","issue_url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/234","id":76549036,"user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"created_at":"2015-02-28T21:55:23Z","updated_at":"2015-02-28T21:55:23Z","body":"```\nI have this problem in the google tasks api when I \"Move.execute()\" a task.\n\n\n```\n\nOriginal comment by `mwb...@gmail.com` on 1 Jul 2011 at 10:30"}}