[Solved] Send content body with HTTP GET Request in Java [closed]


You need to use the below

public class HttpGetWithBody extends HttpEntityEnclosingRequestBase {

    @Override
    public String getMethod() {
        return "GET";
    }
}

HttpGetWithBody getWithBody = new HttpGetWithBody ();
getWithBody.setEntity(y(new ByteArrayEntity(
            "<SOMEPAYLOAD FOR A GET ???>".toString().getBytes("UTF8"))););
getResponse = httpclient.execute(getWithBody );

Import needed will be org.apache.http.client.methods.HttpEntityEnclosingRequestBase;

solved Send content body with HTTP GET Request in Java [closed]