@@ -11,7 +11,7 @@ public class GraphQLHttpClient : IGraphQLClient, IDisposable
11
11
private readonly Lazy < GraphQLHttpWebSocket > _lazyHttpWebSocket ;
12
12
private GraphQLHttpWebSocket GraphQlHttpWebSocket => _lazyHttpWebSocket . Value ;
13
13
14
- private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource ( ) ;
14
+ private readonly CancellationTokenSource _cancellationTokenSource = new ( ) ;
15
15
16
16
private readonly bool _disposeHttpClient = false ;
17
17
@@ -42,14 +42,17 @@ public class GraphQLHttpClient : IGraphQLClient, IDisposable
42
42
43
43
#region Constructors
44
44
45
- public GraphQLHttpClient ( string endPoint , IGraphQLWebsocketJsonSerializer serializer ) : this ( new Uri ( endPoint ) , serializer ) { }
45
+ public GraphQLHttpClient ( string endPoint , IGraphQLWebsocketJsonSerializer serializer )
46
+ : this ( new Uri ( endPoint ) , serializer ) { }
46
47
47
- public GraphQLHttpClient ( Uri endPoint , IGraphQLWebsocketJsonSerializer serializer ) : this ( o => o . EndPoint = endPoint , serializer ) { }
48
+ public GraphQLHttpClient ( Uri endPoint , IGraphQLWebsocketJsonSerializer serializer )
49
+ : this ( o => o . EndPoint = endPoint , serializer ) { }
48
50
49
- public GraphQLHttpClient ( Action < GraphQLHttpClientOptions > configure , IGraphQLWebsocketJsonSerializer serializer ) : this ( configure . New ( ) , serializer ) { }
51
+ public GraphQLHttpClient ( Action < GraphQLHttpClientOptions > configure , IGraphQLWebsocketJsonSerializer serializer )
52
+ : this ( configure . New ( ) , serializer ) { }
50
53
51
- public GraphQLHttpClient ( GraphQLHttpClientOptions options , IGraphQLWebsocketJsonSerializer serializer ) : this (
52
- options , serializer , new HttpClient ( options . HttpMessageHandler ) )
54
+ public GraphQLHttpClient ( GraphQLHttpClientOptions options , IGraphQLWebsocketJsonSerializer serializer )
55
+ : this ( options , serializer , new HttpClient ( options . HttpMessageHandler ) )
53
56
{
54
57
// set this flag to dispose the internally created HttpClient when GraphQLHttpClient gets disposed
55
58
_disposeHttpClient = true ;
@@ -120,7 +123,7 @@ private async Task<GraphQLHttpResponse<TResponse>> SendHttpRequestAsync<TRespons
120
123
121
124
var contentStream = await httpResponseMessage . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
122
125
123
- if ( httpResponseMessage . IsSuccessStatusCode )
126
+ if ( Options . IsValidResponseToDeserialize ( httpResponseMessage ) )
124
127
{
125
128
var graphQLResponse = await JsonSerializer . DeserializeFromUtf8StreamAsync < TResponse > ( contentStream , cancellationToken ) . ConfigureAwait ( false ) ;
126
129
return graphQLResponse . ToGraphQLHttpResponse ( httpResponseMessage . Headers , httpResponseMessage . StatusCode ) ;
@@ -167,7 +170,7 @@ public void Dispose()
167
170
}
168
171
169
172
private volatile bool _disposed ;
170
- private readonly object _disposeLocker = new object ( ) ;
173
+ private readonly object _disposeLocker = new ( ) ;
171
174
172
175
protected virtual void Dispose ( bool disposing )
173
176
{
0 commit comments