I'm using Okio to download a file....with my request i'm sending some parameters, but since I wasn't getting my file and I was able to log my request and this is what is see:
Why tags is null? that means that the parameters are null
Request: Request{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();
Here is example:
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();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.