使用HttpUrlConnection的Http PATCH示例?

时间:2014-04-02 15:41:39

标签: java android

有没有人在Android上使用HttpUrlConnection有一个工作的PATCH请求示例?我尝试过这样的事情:

HttpURLConnection conn = (HttpURLConnection) (new URL(myUrl).openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("PATCH");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept", "application/json");

OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(" {\"name\": \"john\" }");
wr.flush();

由于

0 个答案:

没有答案