From c0a3150d7588c73fb9289fca5ec30bca14842e25 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Sun, 3 Dec 2023 16:25:59 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dio/lib/src/adapters/io_adapter.dart | 4 ++-- dio/test/options_test.dart | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dio/lib/src/adapters/io_adapter.dart b/dio/lib/src/adapters/io_adapter.dart index 795c0fe61..50feaff6d 100644 --- a/dio/lib/src/adapters/io_adapter.dart +++ b/dio/lib/src/adapters/io_adapter.dart @@ -238,12 +238,12 @@ class IOHttpClientAdapter implements HttpClientAdapter { }); } - responseSubscription = responseStream.listen( + responseSubscription = responseStream.cast().listen( (data) { watchReceiveTimeout(); // Always true if the receive timeout was not set. if (receiveStopwatch.elapsed <= receiveTimeout) { - responseSink.add(data is Uint8List ? data : Uint8List.fromList(data)); + responseSink.add(data); } }, onError: (error, stackTrace) { diff --git a/dio/test/options_test.dart b/dio/test/options_test.dart index 086fe8b34..f7d7a8464 100644 --- a/dio/test/options_test.dart +++ b/dio/test/options_test.dart @@ -561,8 +561,7 @@ void main() { when(response.reasonPhrase).thenReturn('OK'); when(response.isRedirect).thenReturn(false); when(response.redirects).thenReturn([]); - when(response.transform(any)) - .thenAnswer((_) => Stream.empty()); + when(response.cast()).thenAnswer((_) => Stream.empty()); return Future.value(request); });