Skip to content

Commit

Permalink
update: 更新RestSharp版本和项目版本
Browse files Browse the repository at this point in the history
  • Loading branch information
zkhssb committed Jul 12, 2023
1 parent 840e288 commit 66e8296
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions QQChannelSharp/OpenApi/OpenApiFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/*
Expand All @@ -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/");
Expand All @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions QQChannelSharp/QQChannelSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<VersionPrefix>1.0.0-beta2</VersionPrefix>
<VersionPrefix>1.0.0-beta3</VersionPrefix>
</PropertyGroup>

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

<ItemGroup>
<PackageReference Include="RestSharp" Version="108.0.3" />
<PackageReference Include="RestSharp" Version="110.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 66e8296

Please sign in to comment.