@@ -48,8 +48,6 @@ public async Task<T> GetAsync<T>(
48
48
JsonSerializerSettings serializerSettings = null ,
49
49
CancellationToken cancellationToken = default )
50
50
{
51
- EnsureHttpClient ( ) ;
52
-
53
51
var response = await SendAsync ( uri , HttpMethod . Get , queryParams , headers , cancellationToken : cancellationToken ) ;
54
52
55
53
return await response . ParseStreamAsync < T > ( serializerSettings ) ;
@@ -82,6 +80,8 @@ private async Task<HttpResponseMessage> SendAsync(
82
80
Action < HttpRequestMessage > attachContent = null ,
83
81
CancellationToken cancellationToken = default )
84
82
{
83
+ EnsureHttpClient ( ) ;
84
+
85
85
requestUri = AddQueryString ( requestUri , queryParams ) ;
86
86
87
87
HttpRequestMessage httpRequest = new HttpRequestMessage ( httpMethod , requestUri ) ;
@@ -121,8 +121,6 @@ public async Task<T> PostAsync<T>(
121
121
JsonSerializerSettings serializerSettings = null ,
122
122
CancellationToken cancellationToken = default )
123
123
{
124
- EnsureHttpClient ( ) ;
125
-
126
124
void AttachContent ( HttpRequestMessage httpRequest )
127
125
{
128
126
httpRequest . Content = new StringContent ( JsonConvert . SerializeObject ( body , defaultSerializerSettings ) , Encoding . UTF8 , "application/json" ) ;
@@ -135,8 +133,6 @@ void AttachContent(HttpRequestMessage httpRequest)
135
133
136
134
public async Task < T > PatchAsync < T > ( string uri , object body , IDictionary < string , string > queryParams = null , IDictionary < string , string > headers = null , JsonSerializerSettings serializerSettings = null , CancellationToken cancellationToken = default )
137
135
{
138
- EnsureHttpClient ( ) ;
139
-
140
136
void AttachContent ( HttpRequestMessage httpRequest )
141
137
{
142
138
var serializedBody = JsonConvert . SerializeObject ( body , defaultSerializerSettings ) ;
0 commit comments