java - GET request with request body in OkHttp -
i'm trying use okhttp 3.6.0 elasticsearch , i'm stuck sending requests elasticsearch multi api.
it requires sending http request request body. unfortunately okhttp doesn't support out of box , throws exception if try build request myself.
requestbody body = requestbody.create("text/plain", "test"); // no requestbody supported request request = new request.builder() .url("http://example.com") .get() .build(); // throws: java.lang.illegalargumentexception: method must not have request body. request request = new request.builder() .url("http://example.com") .method("get", requestbody) .build(); is there chance build request request body in okhttp?
related questions:
Comments
Post a Comment