From bc0f6dc8b8002c10d9a1952e0c9944bc8484d949 Mon Sep 17 00:00:00 2001 From: FS Date: Fri, 8 Dec 2023 17:42:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?mirai=20http=20=E6=8F=92=E4=BB=B6=E5=8D=87?= =?UTF-8?q?=E5=88=B0=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC=EF=BC=882.10.0?= =?UTF-8?q?=EF=BC=89=E6=8A=A5=E9=94=99=EF=BC=8CPost=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0{=20"Content-Type",=20"application/j?= =?UTF-8?q?son"=20}=20=E8=AF=B7=E6=B1=82=E5=A4=B4=E5=90=8E=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mirai.Net/Utils/Internal/MiraiHttpUtils.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Mirai.Net/Utils/Internal/MiraiHttpUtils.cs b/Mirai.Net/Utils/Internal/MiraiHttpUtils.cs index 6dbbbe5..0267a85 100644 --- a/Mirai.Net/Utils/Internal/MiraiHttpUtils.cs +++ b/Mirai.Net/Utils/Internal/MiraiHttpUtils.cs @@ -6,6 +6,7 @@ using Mirai.Net.Sessions; using Newtonsoft.Json; using System; +using System.Collections.Generic; using System.Threading.Tasks; using NullValueHandling = Newtonsoft.Json.NullValueHandling; @@ -116,12 +117,16 @@ public static async Task PostJsonAsync(string url, object json, bool wit { var result = withSessionKey ? await url - .WithHeader("Authorization", $"session {MiraiBot.Instance.HttpSessionKey}") + .WithHeaders(new Dictionary() { { "Content-Type", "application/json" } + , { "Authorization", $"session {MiraiBot.Instance.HttpSessionKey}" } + }) .PostStringAsync(json.ToJsonString(new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })) - : await url.PostStringAsync(json.ToJsonString(new JsonSerializerSettings + : await url + .WithHeaders(new Dictionary() { { "Content-Type", "application/json" } }) + .PostStringAsync(json.ToJsonString(new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); From 497ddd049601ffcd9eef712a8a31b78b5d4d2adf Mon Sep 17 00:00:00 2001 From: FS Date: Wed, 10 Jan 2024 14:07:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8D=87=E9=AB=98=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mirai.Net/Mirai.Net.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mirai.Net/Mirai.Net.csproj b/Mirai.Net/Mirai.Net.csproj index c65ee44..8ecb3a2 100644 --- a/Mirai.Net/Mirai.Net.csproj +++ b/Mirai.Net/Mirai.Net.csproj @@ -3,7 +3,7 @@ latest true - 2.5.1 + 2.5.2 Mirai.Net latest 基于mirai-api-http的轻量级mirai社区sdk