小编Mat*_*ías的帖子

Okhttp3-不推荐使用RequestBody.create(contentType,content)

我没有找到任何有关如何替换弃用方法的示例。okhttp3主页上的示例很旧。这是其中之一:

public static final MediaType JSON = MediaType.get("application/json; charset=utf-8");

OkHttpClient client = new OkHttpClient();

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();
  }
}
Run Code Online (Sandbox Code Playgroud)

如果有人可以解决,请多多帮助。

更新:我正在使用'com.squareup.okhttp3:okhttp:4.0.1'

java okhttp okhttp3

13
推荐指数
6
解决办法
5923
查看次数

Telegram 超过 20 个机器人

我在 Telegram 中使用了 20 个机器人,当我想创建超过 20 个机器人时,机器人之父告诉我以下内容:

\n\n

我做不到。\n你来找我要 20 多个机器人。但你问的时候并不尊重。你不提供友谊。你甚至不想叫我“Botfather”。

\n\n

在电报帮助中我没有找到任何东西,有人知道一些事情。

\n\n

谢谢,Mat\xc3\xadas。

\n

bots telegram

5
推荐指数
1
解决办法
2381
查看次数

标签 统计

bots ×1

java ×1

okhttp ×1

okhttp3 ×1

telegram ×1