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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -