如何使用 Okio 发出 post 请求?

How to make a post request using Okio?

我正在使用 Okio 下载文件....根据我的请求,我发送了一些参数,但由于我没有收到我的文件,所以我能够记录我的请求,这就是见:

为什么标签为空?这意味着参数为 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();

示例如下:

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://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/guide/PostExample.java