title: GET request with request body in OkHttp
body: <p>I'm trying to use OkHttp 3.6.0 with Elasticsearch and I'm stuck with sending requests to the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-multi-get.html" rel="noreferrer">Elasticsearch Multi GET API</a>.</p>
  
  <p>It requires sending an HTTP GET request with a request body. Unfortunately OkHttp doesn't support this out of the box and throws an exception if I try to build the request myself.</p>
  
  <pre><code>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 GET must not have a request body.
  Request request = new Request.Builder()
                    .url("http://example.com")
                    .method("GET", requestBody)
                    .build();
  </code></pre>
  
  <p>Is there any chance to build a GET request with request body in OkHttp?</p>
  
  <p><em>Related questions:</em></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/978061/http-get-with-request-body">HTTP GET with request body</a></li>
  <li><a href="https://stackoverflow.com/questions/35743516/how-to-make-okhttp-post-request-without-a-request-body">How to make OKHTTP post request without a request body?</a></li>
  <li><a href="https://stackoverflow.com/questions/36939748/elasticsearch-get-request-with-request-body">Elasticsearch GET request with request body</a></li>
  </ul>