mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-15 14:19:29 +00:00
Improve HttpClient with client constructor
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.IO;
|
using System.Extensions;
|
||||||
|
using System.IO;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -56,6 +57,15 @@ public sealed class HttpClient<Tscope> : IHttpClient<Tscope>, IDisposable
|
|||||||
this.scope = typeof(Tscope);
|
this.scope = typeof(Tscope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public HttpClient(
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
HttpClient httpClient)
|
||||||
|
{
|
||||||
|
this.httpClient = httpClient.ThrowIfNull(nameof(httpClient));
|
||||||
|
this.scope = typeof(Tscope);
|
||||||
|
}
|
||||||
|
|
||||||
public void CancelPendingRequests()
|
public void CancelPendingRequests()
|
||||||
{
|
{
|
||||||
this.LogInformation(string.Empty, "Canceling request");
|
this.LogInformation(string.Empty, "Canceling request");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||||
<RootNamespace>System</RootNamespace>
|
<RootNamespace>System</RootNamespace>
|
||||||
<Version>1.6.3</Version>
|
<Version>1.6.4</Version>
|
||||||
<Authors>Alexandru Macocian</Authors>
|
<Authors>Alexandru Macocian</Authors>
|
||||||
<RepositoryUrl>https://github.com/AlexMacocian/SystemExtensions</RepositoryUrl>
|
<RepositoryUrl>https://github.com/AlexMacocian/SystemExtensions</RepositoryUrl>
|
||||||
<Description>Extensions for the System namespace</Description>
|
<Description>Extensions for the System namespace</Description>
|
||||||
|
|||||||
Reference in New Issue
Block a user