diff --git a/QQChannelSharp/OpenApi/OpenApiFactory.cs b/QQChannelSharp/OpenApi/OpenApiFactory.cs
index bc78b6c..67e21ca 100644
--- a/QQChannelSharp/OpenApi/OpenApiFactory.cs
+++ b/QQChannelSharp/OpenApi/OpenApiFactory.cs
@@ -15,6 +15,11 @@ public static IOpenApi Create(OpenApiOptions options)
{
HttpClient httpClient;
RestClient restClient;
+ var opts = new RestClientOptions()
+ {
+ ThrowOnAnyError = false,
+ Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(options.BotInfo.FullToken, "Bot")
+ };
if (options.Retry)
{
/*
@@ -25,10 +30,7 @@ public static IOpenApi Create(OpenApiOptions options)
.OrResult(x => x.StatusCode is >= HttpStatusCode.InternalServerError or HttpStatusCode.RequestTimeout or HttpStatusCode.GatewayTimeout)
.WaitAndRetryAsync(Backoff.DecorrelatedJitterBackoffV2(TimeSpan.FromSeconds(1), 5));
*/
- var opts = new RestClientOptions()
- {
- ThrowOnAnyError = false
- };
+
var handler = new PolicyHttpMessageHandler(DecorrelatedJitterBackoffV2.GetRetryIntervals(options.RetryCount, options.RetryInterval), new LoggerHttpHandler());
httpClient = new(handler);
httpClient.BaseAddress = new Uri(options.BotInfo.SandBox ? "https://sandbox.api.sgroup.qq.com/" : "https://api.sgroup.qq.com/");
@@ -38,10 +40,8 @@ public static IOpenApi Create(OpenApiOptions options)
{
httpClient = new(new LoggerHttpHandler());
httpClient.BaseAddress = new Uri(options.BotInfo.SandBox ? "https://sandbox.api.sgroup.qq.com/" : "https://api.sgroup.qq.com/");
- restClient = new(httpClient);
+ restClient = new(httpClient, opts);
}
- // 添加验证Header "Bot {appId}.{token}"
- restClient.UseAuthenticator(new OAuth2AuthorizationRequestHeaderAuthenticator(options.BotInfo.FullToken, "Bot"));
return new OpenApi(restClient, httpClient);
}
}
diff --git a/QQChannelSharp/QQChannelSharp.csproj b/QQChannelSharp/QQChannelSharp.csproj
index 62d0e0f..d67d85a 100644
--- a/QQChannelSharp/QQChannelSharp.csproj
+++ b/QQChannelSharp/QQChannelSharp.csproj
@@ -14,7 +14,7 @@
True
Apache-2.0
README.md
- 1.0.0-beta2
+ 1.0.0-beta3
@@ -27,7 +27,7 @@
-
+