diff --git a/pkgs/http_client_conformance_tests/lib/src/request_cookies_server.dart b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server.dart index 44653a7cd5..512fb5b1b4 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_cookies_server.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_cookies_server.dart @@ -25,7 +25,7 @@ void hybridMain(StreamChannel channel) async { final request = utf8.decoder.bind(socket).transform(const LineSplitter()); final cookies = []; - request.listen((line) { + await for (final line in request) { if (line.toLowerCase().startsWith('cookie:')) { cookies.add(line); } @@ -33,8 +33,9 @@ void hybridMain(StreamChannel channel) async { if (line.isEmpty) { // A blank line indicates the end of the headers. channel.sink.add(cookies); + break; } - }); + } socket.writeAll( [