MCPcopy Create free account
hub / github.com/bcvgh/daydayEXP / post

Method post

src/main/java/com/bcvgh/utils/HttpTools.java:99–127  ·  view source on GitHub ↗
(String url, T postString, HashMap<String, ?> headers, String encoding)

Source from the content-addressed store, hash-verified

97// }
98
99 public static <T> Response post(String url, T postString, HashMap<String, ?> headers, String encoding) {
100 Response response = new Response(0, (String)null, (String)null, (String)null);
101
102 try {
103 HttpURLConnection conn = getCoon(url);
104 conn.setRequestMethod("POST");
105 Iterator var5 = headers.keySet().iterator();
106
107 while(var5.hasNext()) {
108 String key = (String)var5.next();
109 conn.setRequestProperty(key, (String)headers.get(key));
110 }
111
112 OutputStream outputStream = conn.getOutputStream();
113 if (postString instanceof String){
114 outputStream.write(((String) postString).getBytes());
115 }else {
116 outputStream.write((byte[]) postString);
117 }
118 outputStream.flush();
119 outputStream.close();
120 response = getResponse(conn, encoding);
121 } catch (Exception var8) {
122 LOGGER.debug(var8.getMessage());
123 response.setError(var8.getMessage());
124 }
125
126 return response;
127 }
128
129 private static Response getResponse(HttpURLConnection conn, String encoding) {
130 Response response = new Response(0, (String)null, (String)null, (String)null);

Callers 2

checkVulMethod · 0.95
exploitVulMethod · 0.95

Calls 4

getCoonMethod · 0.95
getResponseMethod · 0.95
setErrorMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected