Why Unirest needed?

Normally this type we make HTTP get Request:

private static void sendGET() throws IOException { URL obj = new URL(GET_URL); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); int responseCode = con.getResponseCode(); System.out.println("GET Response Code :: " + responseCode); if (responseCode == HttpURLConnection.HTTP_OK) { // success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); // print result System.out.println(response.toString()); } else { System.out.println("GET request not worked”);} } }

GET Request using UniRest:

final HttpResponse response = Unirest.get("http://httpbin.org/get").asString();

I think your doubt is clear.

For more details, See Advantages of UniRest.