Simple Http Library to make request and access the response.
- Create a Request Object
- Create instance of HttpClient using request instance.
- Send Request
Request request = new Request("http://httpbin.org/get");
HttpClient client = new HttpClient(request);
Response response = client.execute();
Request request = new Request("http://httpbin.org/get");
request.args("search","amit").args("type","people");
//will convert to http://httpbin.org/get?search=amit&type=people
Response response = new HttpClient(request).execute();
Request request = new Request("http://httpbin.org/post", RequestMethod.POST);
Response response = new HttpClient(request).execute();
Request request = new Request("http://httpbin.org/post", RequestMethod.POST);
//Form-Data
request.form("key1", "value1").form("key2", "value2");
Response response = new HttpClient(request);.execute();
Request request = new Request("http://httpbin.org/gzip");
request.acceptGzipEncoding().uncompress(true);
Response response = new HttpClient(request).execute();
Request request = new Request("https://httpbin.org/get");
//To trust all certificate
request.trustCert(true);
Response response = new HttpClient(request).execute();