diff --git a/src/GraphQL.Client.Serializer.Newtonsoft/NewtonsoftJsonSerializer.cs b/src/GraphQL.Client.Serializer.Newtonsoft/NewtonsoftJsonSerializer.cs index cc1d78bc..4d74bf6e 100644 --- a/src/GraphQL.Client.Serializer.Newtonsoft/NewtonsoftJsonSerializer.cs +++ b/src/GraphQL.Client.Serializer.Newtonsoft/NewtonsoftJsonSerializer.cs @@ -38,19 +38,19 @@ public byte[] SerializeToBytes(GraphQLWebSocketRequest request) return Encoding.UTF8.GetBytes(json); } - public Task DeserializeToWebsocketResponseWrapperAsync(Stream stream) => DeserializeFromUtf8Stream(stream); + public Task DeserializeToWebsocketResponseWrapperAsync(Stream stream) => DeserializeFromUtf8Stream(stream, DefaultJsonSerializerSettings); public GraphQLWebSocketResponse DeserializeToWebsocketResponse(byte[] bytes) => JsonConvert.DeserializeObject>(Encoding.UTF8.GetString(bytes), JsonSerializerSettings); - public Task> DeserializeFromUtf8StreamAsync(Stream stream, CancellationToken cancellationToken) => DeserializeFromUtf8Stream>(stream); + public Task> DeserializeFromUtf8StreamAsync(Stream stream, CancellationToken cancellationToken) => DeserializeFromUtf8Stream>(stream, JsonSerializerSettings); - private Task DeserializeFromUtf8Stream(Stream stream) + private static Task DeserializeFromUtf8Stream(Stream stream, JsonSerializerSettings jsonSerializerSettings) { using var sr = new StreamReader(stream); using JsonReader reader = new JsonTextReader(sr); - var serializer = JsonSerializer.Create(JsonSerializerSettings); + var serializer = JsonSerializer.Create(jsonSerializerSettings); return Task.FromResult(serializer.Deserialize(reader)); } }