Java code example

StringEntity reqEntity = new StringEntity("{body}"); request.setEntity(reqEntity); > The method setEntity(StringEntity) is undefined for the type HttpGet


    Hi, do you have to set a "body" for a GET method?
    Posted by Hidden Thu, 30 Jul 2020 14:17:06 GMT
    The issue solved with new class creation (HttpGetWithEntity) and using the new class instead of HttpGet import; import org.apache.http.client.methods.HttpPost; public class HttpGetWithEntity extends HttpPost { public final static String METHOD_NAME = "GET"; public HttpGetWithEntity(URI url) { super(url); } public HttpGetWithEntity(String url) { super(url); } @Override public String getMethod() { return METHOD_NAME; }
    Posted by Hidden Fri, 31 Jul 2020 07:25:57 GMT

You're not signed in. Please sign-in to report an issue or post a comment.