你是怎么做HTTP PUT的?我正在使用的类似乎认为它正在做一个PUT,但是端点正在对待它,好像我做了一个GET.我做错了吗?
URL url = new URL("https://..."); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("PUT"); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); writer.write(xmlString); writer.close(); System.out.println(conn.getRequestMethod()); String response = readInputStream(conn.getInputStream()); System.out.println(response);
哪个是印刷:
PUT <same content as doing a GET>
如果这个可以工作,我宁愿不包括另一个库…