@@ -11,7 +11,7 @@ public class GraphQLHttpClient : IGraphQLClient, IDisposable
1111 private readonly Lazy < GraphQLHttpWebSocket > _lazyHttpWebSocket ;
1212 private GraphQLHttpWebSocket GraphQlHttpWebSocket => _lazyHttpWebSocket . Value ;
1313
14- private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource ( ) ;
14+ private readonly CancellationTokenSource _cancellationTokenSource = new ( ) ;
1515
1616 private readonly bool _disposeHttpClient = false ;
1717
@@ -42,14 +42,17 @@ public class GraphQLHttpClient : IGraphQLClient, IDisposable
4242
4343 #region Constructors
4444
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 ) { }
4647
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 ) { }
4850
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 ) { }
5053
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 ) )
5356 {
5457 // set this flag to dispose the internally created HttpClient when GraphQLHttpClient gets disposed
5558 _disposeHttpClient = true ;
@@ -120,7 +123,7 @@ private async Task<GraphQLHttpResponse<TResponse>> SendHttpRequestAsync<TRespons
120123
121124 var contentStream = await httpResponseMessage . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
122125
123- if ( httpResponseMessage . IsSuccessStatusCode )
126+ if ( Options . IsValidResponseToDeserialize ( httpResponseMessage ) )
124127 {
125128 var graphQLResponse = await JsonSerializer . DeserializeFromUtf8StreamAsync < TResponse > ( contentStream , cancellationToken ) . ConfigureAwait ( false ) ;
126129 return graphQLResponse . ToGraphQLHttpResponse ( httpResponseMessage . Headers , httpResponseMessage . StatusCode ) ;
@@ -167,7 +170,7 @@ public void Dispose()
167170 }
168171
169172 private volatile bool _disposed ;
170- private readonly object _disposeLocker = new object ( ) ;
173+ private readonly object _disposeLocker = new ( ) ;
171174
172175 protected virtual void Dispose ( bool disposing )
173176 {
0 commit comments