public DmhyFactory(HttpClient httpClient) { if (httpClient == null) { throw new ArgumentNullException(nameof(httpClient)); } _dmhyHttpClient = new DmhyHttpClient(httpClient); }
public async static Task <string> DownloadHtmlAsync(IDmhyHttpClient client, string url) { using (HttpResponseMessage message = await client.GetAsync(url)) { if (message.StatusCode != HttpStatusCode.OK) { throw new Exception($"请求:{url}时,未得到正确的响应。错误响应为:{message.StatusCode},响应内容为:{message.Content}"); } return(await message.Content.ReadAsStringAsync()); } }
public DmhyPost(IDmhyHttpClient httpClient) { _httpClient = httpClient; }
public DmhyPostDetailed(IDmhyHttpClient httpClient) { _httpClient = httpClient; }
public DmhyInfo(IDmhyHttpClient httpClient) { _httpClient = httpClient; }