我正在努力实现这一目标
哪个是/delete/{id}
如何在Java中做到这一点?
String id = "123";
OkHttpClient client = new OkHttpClient();
RequestBody form = new FormBody.Builder()
.add("id", id)
.build();
Request request = new Request.Builder()
.url("http://localhost:3002/delete/")
.put(form)
.build();
client.newCall(request).execute();
不起作用。如何为此添加url参数?
答案 0 :(得分:0)
将CHECKSUM
附加到var xorcodes = [
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
0, 33, 34, 35, 36, 37, 38, 39, // !"#$%&'
40, 41, 42, 43, 44, 45, 46, 47, // ()*+,-./
132, 133, 134, 135, 136, 137, 138, 139, // 01234567
140, 141, 48, 49, 50, 51, 52, 53, 54, // 89:;<=>?@
142, 143, 144, 145, 146, 147, 148, 149, // ABCDEFGH
150, 151, 152, 153, 154, 155, 156, 157, // IJKLMNOP
158, 159, 160, 161, 162, 163, 164, 165, // QRSTUVWX
166, 167, 55, 56, 57, 58, 59, 60, // YZ[\]^_`
142, 143, 144, 145, 146, 147, 148, 149, // abcdefgh
150, 151, 152, 153, 154, 155, 156, 157, // ijklmnop
158, 159, 160, 161, 162, 163, 164, 165, // qrstuvwx
166, 167, 61, 62, 63, 64, 65, 66, // yz{|}~
];
之类的id
函数参数中。您有一个请求查询参数,并且没有将其附加到URL。
另外,url
设置请求正文而不是查询参数。
您可以查看PUT and POST和this post之间的差异以获取更多说明