wanshenmean
2026-03-02 bfd4fd8e4a05a681ec10a47992294cf752a764c4
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs
@@ -10,16 +10,19 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using WIDESEAWCS_Core.Caches;
namespace WIDESEA_Core
{
    public class HttpClientHelper
    {
        private readonly IHttpClientFactory _httpClientFactory;
        private readonly ICacheService _cache;
        public HttpClientHelper(IHttpClientFactory httpClientFactory, IConfiguration configuration = null)
        public HttpClientHelper(IHttpClientFactory httpClientFactory, ICacheService cache, IConfiguration configuration = null)
        {
            _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
            _cache = cache ?? throw new ArgumentNullException(nameof(cache));
        }
        /// <summary>
@@ -32,6 +35,7 @@
        /// <returns></returns>
        public HttpResponseResult Post(string url, string content, string contentType = "application/json", HttpRequestConfig? config = null)
        {
            url = _cache.Get(url);
            HttpResponseResult httpResponseResult = ExecuteAsync(async (client) =>
            {
                var request = new HttpRequestMessage(HttpMethod.Post, url);