SSE onDone cleanup fix & moved SSEDisplay to its own file

This commit is contained in:
Manas Hejmadi
2025-07-03 03:46:50 +05:30
parent 7b17cb567b
commit ce1a463d75
3 changed files with 92 additions and 134 deletions

View File

@@ -347,9 +347,10 @@ Future<Stream<HttpStreamOutput>> streamHttpRequest(
//handle cases where response is larger than a TCP packet and cuts mid-way
if (!hasEmitted && !controller.isClosed) {
final response = getResponseFromBytes(buffer.toString().codeUnits);
if (response.body.trim().isEmpty) return;
final isStreaming = kStreamingResponseTypes.contains(contentType);
controller.add((isStreaming, response, stopwatch.elapsed, null));
if (response.body.trim().isNotEmpty) {
final isStreaming = kStreamingResponseTypes.contains(contentType);
controller.add((isStreaming, response, stopwatch.elapsed, null));
}
}
cleanup();
},