23 lines
754 B
C#
23 lines
754 B
C#
using System.Net.Http.Headers;
|
|
using System.Text;
|
|
using Kurisu.AspNetCore.Startup;
|
|
|
|
namespace Dlhis.ScheduledTask.Packs;
|
|
|
|
public class JinkoSapHttpClientPack : BaseAppPack
|
|
{
|
|
public override bool IsBeforeUseRouting { get; }
|
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddHttpClient("jinko:sap", (sp, httpClient) =>
|
|
{
|
|
httpClient.Timeout = TimeSpan.FromMinutes(10);
|
|
|
|
var credentials = string.Format("{0}:{1}", "EHS_USER", "y3R1hd2h*RICAC");
|
|
var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
|
|
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
|
|
});
|
|
}
|
|
}
|