private async Task <string> RequestAsync(ApiRequestParameters parameters) { var requestUrl = $"http://alidns.aliyuncs.com/?{parameters.GenerateSortedQueryString()}"; try { using (var request = new HttpRequestMessage(HttpMethod.Get, requestUrl)) { var result = await _httpClient.SendAsync(request); string requestContent = await result.Content.ReadAsStringAsync(); if (string.IsNullOrEmpty(requestContent)) { ConsoleHelper.WriteError($"远程请求出错:{request.ToString()}"); } return(requestContent); } } catch (Exception ex) { ConsoleHelper.WriteError($"阿里云API请求出错,错误原因为:\r\n{ex.Message}"); return(""); } }
private async Task <string> RequestAsync(ApiRequestParameters parameters) { var requestUrl = $"http://alidns.aliyuncs.com/?{parameters.GenerateSortedQueryString()}"; using (var request = new HttpRequestMessage(HttpMethod.Get, requestUrl)) { var result = await _httpClient.SendAsync(request); return(await result.Content.ReadAsStringAsync()); } }
private async Task <string> RequestAsync(ApiRequestParameters parameters) { var requestUrl = $"http://alidns.aliyuncs.com/?{parameters.GenerateSortedQueryString()}"; using (var request = new HttpRequestMessage(HttpMethod.Get, requestUrl)) { var result = await _httpClient.SendAsync(request); string requestContent = await result.Content.ReadAsStringAsync(); if (string.IsNullOrEmpty(requestContent)) { AliCloudDynamicDNS.Utility.ConsoleHelper.WriteError($"远程请求出错:{request.ToString()}"); } return(requestContent); } }