/// <summary>
        /// 获取指定方法key的uri地址
        /// </summary>
        /// <param name="config"></param>
        /// <param name="mothedKey">方法Key</param>
        /// <returns></returns>
        public static string GetMethodKeyUri(this RequestAPIConfig config, string mothedKey)
        {
            var uriConfig = config?.RequestUriConfigs?.Find(x => x.MethodKey.EqualIgnoreCase(mothedKey));

            if (uriConfig == null || uriConfig.RequestUri.IsNullOrEmpty())
            {
                throw new HttpRequestConnectionException($"接口请求:{mothedKey}uri地址尚未配置");
            }

            return(uriConfig.RequestUri);
        }
Ejemplo n.º 2
0
 public APIRequest(IHttpClientFactory clientFactory, IOptions <RequestAPIConfig> reqOption, IULogProvider logProvider)
 {
     _clientFactory     = clientFactory;
     _httpRequestConfig = reqOption.Value;
     _uLog = logProvider.GetHttpRequestULog();
 }