fix 请求客户端修改
This commit is contained in:
@@ -7,7 +7,7 @@ public class ClientHandler : IHttpRemoteCallPolicyHandler
|
||||
/// <inheritdoc />
|
||||
public IHttpClientBuilder ConfigureHttpClient(IHttpClientBuilder builder)
|
||||
{
|
||||
builder.ConfigureHttpClient(client => { client.Timeout = TimeSpan.FromSeconds(10); }).ConfigurePrimaryHttpMessageHandler(() =>
|
||||
builder.ConfigureHttpClient(client => { client.Timeout = TimeSpan.FromMinutes(5); }).ConfigurePrimaryHttpMessageHandler(() =>
|
||||
{
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
@@ -17,7 +17,7 @@ public class ClientHandler : IHttpRemoteCallPolicyHandler
|
||||
|
||||
return handler;
|
||||
});
|
||||
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
23
Src/Dlhis.Middle/Apis/Handlers/HealthzClientHandler.cs
Normal file
23
Src/Dlhis.Middle/Apis/Handlers/HealthzClientHandler.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Kurisu.RemoteCall.Abstractions;
|
||||
|
||||
namespace Dlhis.Middle.Apis.Handlers;
|
||||
|
||||
public class HealthzClientHandler : IHttpRemoteCallPolicyHandler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public IHttpClientBuilder ConfigureHttpClient(IHttpClientBuilder builder)
|
||||
{
|
||||
builder.ConfigureHttpClient(client => { client.Timeout = TimeSpan.FromSeconds(10); }).ConfigurePrimaryHttpMessageHandler(() =>
|
||||
{
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
ClientCertificateOptions = ClientCertificateOption.Manual,
|
||||
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
|
||||
};
|
||||
|
||||
return handler;
|
||||
});
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,17 @@ public interface ICommonApi
|
||||
[Post("/api/user/oauth2/clientgrant")]
|
||||
public Task<DefaultApiResult<TokenResponse>> AuthAsync(object request);
|
||||
|
||||
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
|
||||
[Post("/api/common/middles/healthz")]
|
||||
public Task<DefaultApiResult> CheckHealthAsync(HealthCheckRequest request);
|
||||
|
||||
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
|
||||
[Get("/api/common/SysData/download")]
|
||||
public Task<DefaultApiResult<List<T>>> DownloadAsync<T>(string factory, string tableName);
|
||||
}
|
||||
|
||||
//HealthzClientHandler
|
||||
|
||||
[EnableRemoteClient(Name = "face-service", BaseUrl = "${BaseUrl}", PolicyHandler = typeof(HealthzClientHandler))]
|
||||
public interface IHealthzApi
|
||||
{
|
||||
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
|
||||
[Post("/api/common/middles/healthz")]
|
||||
public Task<DefaultApiResult> CheckHealthAsync(HealthCheckRequest request);
|
||||
}
|
||||
Reference in New Issue
Block a user