google-api-services-youtube: v3-rev20200618-1.30.9
google-api-client: 1.30.9
this dependency brings
google-http-client: 1.34.0 but also tried using 1.36.0
I created a Spring Boot application, which should send a search to the Youtube API.
The request fails with
java.lang.IllegalArgumentException: GET with non-zero content length is not supported
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:164) ~[guava-28.2-android.jar:na]
at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:67) ~[google-http-client-1.34.0.jar:1.34.0]
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:141) ~[google-http-client-1.34.0.jar:1.34.0]
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:84) ~[google-http-client-1.34.0.jar:1.34.0]
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1012) ~[google-http-client-1.34.0.jar:1.34.0]
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:542) ~[google-api-client-1.30.9.jar:1.30.9]
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:475) ~[google-api-client-1.30.9.jar:1.30.9]
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:592) ~[google-api-client-1.30.9.jar:1.30.9]
The content lenght, that is getting checked, is set in class HttpRequest:938 to a default value of -1.
With my request to the Youtube API, I just do a GET request, so there is no content to calculate.
It stays at -1 and produces this error.
I would say it needs to be set to 0, in case of a GET request.
Hello,
Used versions:
google-api-services-youtube: v3-rev20200618-1.30.9 google-api-client: 1.30.9 this dependency brings google-http-client: 1.34.0 but also tried using 1.36.0
I created a Spring Boot application, which should send a search to the Youtube API. The request fails with
Creating my Youtube client.
Executing search on Youtube API
The content lenght, that is getting checked, is set in class
HttpRequest
:938 to a default value of-1
. With my request to the Youtube API, I just do aGET
request, so there is no content to calculate. It stays at-1
and produces this error.I would say it needs to be set to 0, in case of a
GET
request.