fix: ignore empty Streamable HTTP JSON responses (#1626)

This commit is contained in:
King Star 2026-07-15 02:23:33 +08:00 • committed by GitHub
commit ffc557f920
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -186,7 +186,10 @@ internal sealed partial class StreamableHttpClientSessionTransport : TransportBa
if (response.Content.Headers.ContentType?.MediaType == "application/json")
{
var responseContent = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
rpcResponseOrError = await ProcessMessageAsync(responseContent, rpcRequest, cancellationToken).ConfigureAwait(false);
if (responseContent.Length > 0)
{
rpcResponseOrError = await ProcessMessageAsync(responseContent, rpcRequest, cancellationToken).ConfigureAwait(false);
}
}
else if (response.Content.Headers.ContentType?.MediaType == "text/event-stream")
{