Skip to content

Commit 66e8296

Browse files
committed
update: 更新RestSharp版本和项目版本
1 parent 840e288 commit 66e8296

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

QQChannelSharp/OpenApi/OpenApiFactory.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public static IOpenApi Create(OpenApiOptions options)
1515
{
1616
HttpClient httpClient;
1717
RestClient restClient;
18+
var opts = new RestClientOptions()
19+
{
20+
ThrowOnAnyError = false,
21+
Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(options.BotInfo.FullToken, "Bot")
22+
};
1823
if (options.Retry)
1924
{
2025
/*
@@ -25,10 +30,7 @@ public static IOpenApi Create(OpenApiOptions options)
2530
.OrResult(x => x.StatusCode is >= HttpStatusCode.InternalServerError or HttpStatusCode.RequestTimeout or HttpStatusCode.GatewayTimeout)
2631
.WaitAndRetryAsync(Backoff.DecorrelatedJitterBackoffV2(TimeSpan.FromSeconds(1), 5));
2732
*/
28-
var opts = new RestClientOptions()
29-
{
30-
ThrowOnAnyError = false
31-
};
33+
3234
var handler = new PolicyHttpMessageHandler(DecorrelatedJitterBackoffV2.GetRetryIntervals(options.RetryCount, options.RetryInterval), new LoggerHttpHandler());
3335
httpClient = new(handler);
3436
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)
3840
{
3941
httpClient = new(new LoggerHttpHandler());
4042
httpClient.BaseAddress = new Uri(options.BotInfo.SandBox ? "https://sandbox.api.sgroup.qq.com/" : "https://api.sgroup.qq.com/");
41-
restClient = new(httpClient);
43+
restClient = new(httpClient, opts);
4244
}
43-
// 添加验证Header "Bot {appId}.{token}"
44-
restClient.UseAuthenticator(new OAuth2AuthorizationRequestHeaderAuthenticator(options.BotInfo.FullToken, "Bot"));
4545
return new OpenApi(restClient, httpClient);
4646
}
4747
}

QQChannelSharp/QQChannelSharp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
1515
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1616
<PackageReadmeFile>README.md</PackageReadmeFile>
17-
<VersionPrefix>1.0.0-beta2</VersionPrefix>
17+
<VersionPrefix>1.0.0-beta3</VersionPrefix>
1818
</PropertyGroup>
1919

2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -27,7 +27,7 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="RestSharp" Version="108.0.3" />
30+
<PackageReference Include="RestSharp" Version="110.2.0" />
3131
</ItemGroup>
3232

3333
<ItemGroup>

0 commit comments

Comments
 (0)