1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-18 11:52:54 +00:00

Added check for invalid json in JsonSocketMessageHandler and virtual GetTypeIdentifierNonJson for handling non-json messages

This commit is contained in:
JKorf
2026-02-22 16:29:05 +01:00
parent 36c2411d46
commit 0ce2e778f4
2 changed files with 18 additions and 0 deletions
@@ -439,6 +439,10 @@ namespace CryptoExchange.Net.Clients
var outputOriginalData = ApiOptions.OutputOriginalData ?? ClientOptions.OutputOriginalData;
if (outputOriginalData || MessageHandler.RequiresSeekableStream || !response.IsSuccessStatusCode)
{
// Create a seekable stream from the response stream if:
// 1. We need to output the original data
// 2. The message handler requires a seekable stream
// 3. The response indicates error and we want to output (part of) the returned data
responseStream = await CopyStreamAsync(responseStream).ConfigureAwait(false);
using var reader = new StreamReader(responseStream, Encoding.UTF8, false, 4096, true);
if (outputOriginalData)