Skip to content

Commit

Permalink
调整Http实用类调用的方法
Browse files Browse the repository at this point in the history
以避免部分平台初始化插件信息的时机不一导致的异常
  • Loading branch information
DreamVoid committed Dec 15, 2024
1 parent 8495308 commit cb05f0b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static String get(String url) throws IOException {

connection.setDoInput(true);
connection.setRequestMethod("GET");
connection.setRequestProperty("User-Agent", String.format("MiraiMC/%s (%s; %s)", MiraiMC.getPlatform().getPluginVersion(), MiraiMC.getPlatform().getType(), System.getProperty("os.name")));
connection.setRequestProperty("User-Agent", String.format("MiraiMCHttp/1.0 (%s; Java %s)", System.getProperty("os.name"), Utils.getJavaVersion()));
connection.setConnectTimeout(5000);
connection.setReadTimeout(10000);

Expand Down Expand Up @@ -152,7 +152,7 @@ public static String post(JsonObject json, String url) throws IOException {

connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("User-Agent", String.format("MiraiMC/%s (%s; %s)", MiraiMC.getPlatform().getPluginVersion(), MiraiMC.getPlatform().getType(), System.getProperty("os.name")));
connection.setRequestProperty("User-Agent", String.format("MiraiMCHttp/1.0 (%s; Java %s)", System.getProperty("os.name"), Utils.getJavaVersion()));
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Basic YWRtaW46");
connection.setConnectTimeout(5000);
Expand Down

0 comments on commit cb05f0b

Please sign in to comment.