sefidgaran / signalr_client

A Flutter SignalR Client for ASP.NET Core
https://pub.dev/packages/signalr_netcore
MIT License
71 stars 111 forks source link

WebSupportingHttpClient: Invalid type cast in log string interpolation #46

Open mich4b opened 1 year ago

mich4b commented 1 year ago

When logging is used, a long-polling connection attempt fails with the following exception: Failed to start the connection: Unable to connect to the server with any of the available transports. HttpTransportType.LongPolling failed: type 'Null' is not a subtype of type 'String' in type cast

The exception is thrown in the WebSupportingHttpClient class (line 72), when request.content is null, but is casted to String to build the log output text.

Suggestion: Leave away the content length altogether, because the string content is printed anyways, and the length can easily be extracted.

_logger?.finest(
          "HTTP send: url '${request.url}', method: '${request.method}' content: '${request.content}' headers: '$headers'");
kyi87 commented 4 months ago

I get the same error