Skip to content

Commit

Permalink
update HTTPUtil to exclude unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoChiesa committed Jun 3, 2021
1 parent f9c8afa commit 47379a0
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ public static Map<String, Object> post(
return result;
}

Map<String, Object> get(String urlToRead) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
URL url = new URL(urlToRead);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setInstanceFollowRedirects(false);
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept-Charset", "UTF-8");
conn.connect();

int code = conn.getResponseCode();
result.put("code", new Integer(code));
result.put("headers", conn.getHeaderFields()); // Map<String, List<String>>
result.put("content", getResponsePayload(conn)); // String
conn.disconnect();
return result;
}
// public static Map<String, Object> get(String urlToRead) throws Exception {
// HashMap<String, Object> result = new HashMap<String, Object>();
// URL url = new URL(urlToRead);
// HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// conn.setInstanceFollowRedirects(false);
// conn.setRequestMethod("GET");
// conn.setRequestProperty("Accept-Charset", "UTF-8");
// conn.connect();
//
// int code = conn.getResponseCode();
// result.put("code", new Integer(code));
// result.put("headers", conn.getHeaderFields()); // Map<String, List<String>>
// result.put("content", getResponsePayload(conn)); // String
// conn.disconnect();
// return result;
// }

}

0 comments on commit 47379a0

Please sign in to comment.