Skip to content

About

Simple Http Library to make request and access the response.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

Repository files navigation

Build Status Dependency Status

Http Request

Simple Http Library to make request and access the response.

  1. Create a Request Object
  2. Create instance of HttpClient using request instance.
  3. Send Request

Send GET Request

Request request = new Request("http://httpbin.org/get");
HttpClient client = new HttpClient(request);
Response response = client.execute();

Pass Query Parameters

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();

Send POST Request

Request request = new Request("http://httpbin.org/post", RequestMethod.POST);
Response response = new HttpClient(request).execute();

Post Request with Form Data

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();

GZip Compression

Request request = new Request("http://httpbin.org/gzip");
request.acceptGzipEncoding().uncompress(true);
Response response = new HttpClient(request).execute();

Trust Certificates

Request request = new Request("https://httpbin.org/get");
//To trust all certificate
request.trustCert(true);
Response response = new HttpClient(request).execute();

About

Simple Http Library to make request and access the response.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages