MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / post

Method post

src/main/java/net/optifine/http/HttpUtils.java:78–132  ·  view source on GitHub ↗
(String urlStr, Map headers, byte[] content)

Source from the content-addressed store, hash-verified

76 }
77
78 public static String post(String urlStr, Map headers, byte[] content) throws IOException
79 {
80 HttpURLConnection httpurlconnection = null;
81 String s3;
82
83 try
84 {
85 URL url = new URL(urlStr);
86 httpurlconnection = (HttpURLConnection)url.openConnection(Minecraft.getMinecraft().getProxy());
87 httpurlconnection.setRequestMethod("POST");
88
89 if (headers != null)
90 {
91 for (Object s : headers.keySet())
92 {
93 String s1 = "" + headers.get(s);
94 httpurlconnection.setRequestProperty((String) s, s1);
95 }
96 }
97
98 httpurlconnection.setRequestProperty("Content-Type", "text/plain");
99 httpurlconnection.setRequestProperty("Content-Length", "" + content.length);
100 httpurlconnection.setRequestProperty("Content-Language", "en-US");
101 httpurlconnection.setUseCaches(false);
102 httpurlconnection.setDoInput(true);
103 httpurlconnection.setDoOutput(true);
104 OutputStream outputstream = httpurlconnection.getOutputStream();
105 outputstream.write(content);
106 outputstream.flush();
107 outputstream.close();
108 InputStream inputstream = httpurlconnection.getInputStream();
109 InputStreamReader inputstreamreader = new InputStreamReader(inputstream, "ASCII");
110 BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
111 StringBuffer stringbuffer = new StringBuffer();
112 String s2;
113
114 while ((s2 = bufferedreader.readLine()) != null)
115 {
116 stringbuffer.append(s2);
117 stringbuffer.append('\r');
118 }
119
120 bufferedreader.close();
121 s3 = stringbuffer.toString();
122 }
123 finally
124 {
125 if (httpurlconnection != null)
126 {
127 httpurlconnection.disconnect();
128 }
129 }
130
131 return s3;
132 }
133
134 public static synchronized String getPlayerItemsUrl()
135 {

Callers 1

runMethod · 0.95

Calls 13

getMinecraftMethod · 0.95
openConnectionMethod · 0.80
getOutputStreamMethod · 0.80
readLineMethod · 0.80
disconnectMethod · 0.80
getMethod · 0.65
flushMethod · 0.65
closeMethod · 0.65
getInputStreamMethod · 0.65
getProxyMethod · 0.45
keySetMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected