我正在使用Okio下载一个file....with --我的请求--我发送了一些参数,但是由于我没有得到我的文件,所以我能够记录我的请求,如下所示:
为什么标签是空的?这意味着参数为null。
请求:请求{method=POST,url=https://mywesite.com/,tag=null}
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("user", "test")
.addFormDataPart("pass", "1234")
.build();
Request request = new Request.Builder()
.url(imageLink)
.post(requestBody)
.build();发布于 2019-05-10 20:10:00
下面是一个例子:
String post(String url, String json) throws IOException {
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
return response.body().string();
}
}https://stackoverflow.com/questions/56083136
复制相似问题