main
wanggaofeng 9 months ago
parent f907d5bc6a
commit 2f98ab7c76

@ -11,6 +11,7 @@ namespace HttpClientStudy.Core
/// </summary>
public class SimpleHttpClient
{
#region Get请求
public string Get(string url)
{
HttpClient client = new HttpClient();
@ -31,7 +32,7 @@ namespace HttpClientStudy.Core
response.EnsureSuccessStatusCode();
//或者
if (response.IsSuccessStatusCode)
{
{
//业务逻辑
}
@ -42,8 +43,8 @@ namespace HttpClientStudy.Core
}
//请求头
if(response is { Headers.ETag:null})
{
if (response is { Headers.ETag: null })
{
//业务逻辑
}
@ -98,5 +99,6 @@ namespace HttpClientStudy.Core
return result;
}
#endregion
}
}

Loading…
Cancel
Save