Debugging shows that the method JsonHttpContent.writeTo() is called twice when a HttpRequest is rendered. For the first time it is called to compute the length of the body and for the second time to actually render the JSON string.
First invocation:
"main@1" prio=5 tid=0x1 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at com.google.api.client.http.json.JsonHttpContent.writeTo(JsonHttpContent.java:73)
at com.google.api.client.util.IOUtils.computeLength(IOUtils.java:113)
at com.google.api.client.http.AbstractHttpContent.computeLength(AbstractHttpContent.java:139)
at com.google.api.client.http.AbstractHttpContent.computeLength(AbstractHttpContent.java:117)
at com.google.api.client.http.AbstractHttpContent.getLength(AbstractHttpContent.java:65)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:914)
Second invocation:
"main@1" prio=5 tid=0x1 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at com.google.api.client.http.json.JsonHttpContent.writeTo(JsonHttpContent.java:73)
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:79)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:965)
Debugging shows that the method
JsonHttpContent.writeTo()is called twice when a HttpRequest is rendered. For the first time it is called to compute the length of the body and for the second time to actually render the JSON string.First invocation:
Second invocation: