achrefB3 / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Set content length for POST requests with no body #216

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?

N/A

Java environments (e.g. Java 6, Android 2.3, App Engine 1.4.2, or All)?

All

Please describe the feature requested.

Some Google API methods require sending a POST with no HTTP content.  However, 
Google's server require a non-zero content on a POST.  Therefore, we need set a 
content of size >= 1, e.g. use:

       request.content = new ByteArrayContent(" ");

in RemoteRequest.execute().

We are already doing that trick for MethodOverride and it seems to work.

Original issue reported on code.google.com by yan...@google.com on 20 May 2011 at 12:57

GoogleCodeExporter commented 9 years ago
Not able to reproduce with current dev branch.   Following up with the original 
reporter.

CONFIG: -------------- REQUEST  --------------
POST https://www.googleapis.com/XXXXXXXXXXXXXXXX
Accept-Encoding: gzip
Authorization: <Not Logged>
User-Agent: Buzz JavaSt Client Sample 
Google-HTTP-Java-Client/1.5.0-beta-SNAPSHOT 
Google-API-Java-Client/1.5.0-beta-SNAPSHOT
Content-Length: 0

CONFIG: -------------- RESPONSE --------------
HTTP/1.1 204 No Content
...

Original comment by ai...@google.com on 31 May 2011 at 9:08