diff --git a/pkgs/http_client_conformance_tests/bin/generate_server_wrappers.dart b/pkgs/http_client_conformance_tests/bin/generate_server_wrappers.dart index 74f9d00df9..6e86737c41 100644 --- a/pkgs/http_client_conformance_tests/bin/generate_server_wrappers.dart +++ b/pkgs/http_client_conformance_tests/bin/generate_server_wrappers.dart @@ -10,12 +10,17 @@ import 'dart:io'; import 'package:dart_style/dart_style.dart'; -const vm = '''// Generated by generate_server_wrappers.dart. Do not edit. +const _export = '''export 'server_queue_helpers.dart' + show StreamQueueOfNullableObjectExtension;'''; + +const _vm = '''// Generated by generate_server_wrappers.dart. Do not edit. import 'package:stream_channel/stream_channel.dart'; import ''; +$_export + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); @@ -24,11 +29,13 @@ Future> startServer() async { } '''; -const web = '''// Generated by generate_server_wrappers.dart. Do not edit. +const _web = '''// Generated by generate_server_wrappers.dart. Do not edit. import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +$_export + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', @@ -41,11 +48,11 @@ void main() async { files.where((file) => file.path.endsWith('_server.dart')).forEach((file) { final vmPath = file.path.replaceAll('_server.dart', '_server_vm.dart'); - File(vmPath).writeAsStringSync(formatter.format(vm.replaceAll( + File(vmPath).writeAsStringSync(formatter.format(_vm.replaceAll( '', file.uri.pathSegments.last))); final webPath = file.path.replaceAll('_server.dart', '_server_web.dart'); - File(webPath).writeAsStringSync(formatter.format(web.replaceAll( + File(webPath).writeAsStringSync(formatter.format(_web.replaceAll( '', file.uri.pathSegments.last))); }); } diff --git a/pkgs/http_client_conformance_tests/lib/src/close_tests.dart b/pkgs/http_client_conformance_tests/lib/src/close_tests.dart index 8194130bcc..39324ad7c6 100644 --- a/pkgs/http_client_conformance_tests/lib/src/close_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/close_tests.dart @@ -20,7 +20,7 @@ void testClose(Client Function() clientFactory) { setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart index 2bb2c1629d..a5ae1e0529 100644 --- a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'compressed_response_body_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart index f8807993d3..7b1d1a6368 100644 --- a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart index 2395aaf494..538b3ba4de 100644 --- a/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart @@ -32,7 +32,7 @@ void testCompressedResponseBody(Client client) async { setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart b/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart index 6b296a2df0..1723ab549c 100644 --- a/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart +++ b/pkgs/http_client_conformance_tests/lib/src/isolate_test.dart @@ -31,7 +31,7 @@ void testIsolate(Client Function() clientFactory, setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart index c689212035..f00f4baffc 100644 --- a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'multiple_clients_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart index 91cfc76aef..3f71aa75cb 100644 --- a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart index 8f8dc813a2..ad40d4a1a9 100644 --- a/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart @@ -21,7 +21,7 @@ void testMultipleClients(Client Function() clientFactory) async { setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart index 7f9cf8c182..4a9450a1f5 100644 --- a/pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/redirect_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'redirect_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart index 0fbe8a3877..a5fb0f2880 100644 --- a/pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/redirect_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart b/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart index 600becc0fe..47a77a7dbf 100644 --- a/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart @@ -23,7 +23,7 @@ void testRedirect(Client client, {bool redirectAlwaysAllowed = false}) async { setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart index 2260766216..d2e1e4a185 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'request_body_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart index 250bd52668..6b6ab0076a 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart index 9f58119bf2..c343d68309 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'request_body_streamed_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart index 97e8fbc689..41477eef4d 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart index 8c0c658e11..0f43505f53 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart @@ -29,7 +29,7 @@ void testRequestBodyStreamed(Client client, setUp(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDown(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart index 2f13fa7fd5..fe12dd4646 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart @@ -47,7 +47,7 @@ void testRequestBody(Client client) { setUp(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDown(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart index 44e65659e9..dc930dc528 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'request_headers_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart index 62e8d9e410..a15b69b75e 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart index a6943871a8..24d94d801a 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_headers_tests.dart @@ -20,7 +20,7 @@ void testRequestHeaders(Client client) async { setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart index 6ce6627f4c..fa25735917 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'request_methods_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart index 8cddf5a175..f9c924e217 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_methods_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/request_methods_tests.dart b/pkgs/http_client_conformance_tests/lib/src/request_methods_tests.dart index ec11387f3d..802f57eb84 100644 --- a/pkgs/http_client_conformance_tests/lib/src/request_methods_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/request_methods_tests.dart @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; import 'request_methods_server_vm.dart' - if (dart.library.html) 'request_methods_server_web.dart'; + if (dart.library.js_interop) 'request_methods_server_web.dart'; /// Tests that the [Client] correctly sends HTTP request methods /// (e.g. GET, HEAD). @@ -25,7 +25,7 @@ void testRequestMethods(Client client, setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart index f88e065c8f..a12b6fb446 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'response_body_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart index 94bdaa90b0..4d23a48a50 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart index 01d84a1475..4e4eaff730 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'response_body_streamed_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart index a9ce00b415..e04ebd622b 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart index b8afa3deb1..f355d6c8de 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_streamed_test.dart @@ -28,7 +28,7 @@ void testResponseBodyStreamed(Client client, setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart index ba833f4a1b..34c29f66ae 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_body_tests.dart @@ -26,7 +26,7 @@ void testResponseBody(Client client, setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart index b7d4a01a3d..c99a021d1a 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'response_headers_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart index 8ee938a36f..0e6dabd17a 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart index 6a3647b196..84f0fb67f8 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart @@ -20,7 +20,7 @@ void testResponseHeaders(Client client) async { setUp(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); test('single header', () async { diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart index ff2ea84f02..053bd111a9 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'response_status_line_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart index f1ebbcbd3a..d70a325a50 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart b/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart index 12fb29c13a..6eb70c518b 100644 --- a/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart +++ b/pkgs/http_client_conformance_tests/lib/src/response_status_line_tests.dart @@ -23,7 +23,7 @@ void testResponseStatusLine(Client client) async { setUp(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); test('complete', () async { diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart index 257adcfa61..e5aa09fa60 100644 --- a/pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart +++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_vm.dart @@ -4,6 +4,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'server_errors_server.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server in the same process. Future> startServer() async { final controller = StreamChannelController(sync: true); diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart index cc763e389f..9614f3601d 100644 --- a/pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart +++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_server_web.dart @@ -3,6 +3,8 @@ import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; +export 'server_queue_helpers.dart' show StreamQueueOfNullableObjectExtension; + /// Starts the redirect test HTTP server out-of-process. Future> startServer() async => spawnHybridUri(Uri( scheme: 'package', diff --git a/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart b/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart index 0e45bc59b9..1a83696853 100644 --- a/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart +++ b/pkgs/http_client_conformance_tests/lib/src/server_errors_test.dart @@ -20,7 +20,7 @@ void testServerErrors(Client client, {bool redirectAlwaysAllowed = false}) { setUpAll(() async { httpServerChannel = await startServer(); httpServerQueue = StreamQueue(httpServerChannel.stream); - host = 'localhost:${await httpServerQueue.next}'; + host = 'localhost:${await httpServerQueue.nextAsInt}'; }); tearDownAll(() => httpServerChannel.sink.add(null)); diff --git a/pkgs/http_client_conformance_tests/lib/src/server_queue_helpers.dart b/pkgs/http_client_conformance_tests/lib/src/server_queue_helpers.dart new file mode 100644 index 0000000000..94aed4f253 --- /dev/null +++ b/pkgs/http_client_conformance_tests/lib/src/server_queue_helpers.dart @@ -0,0 +1,5 @@ +import 'package:async/async.dart'; + +extension StreamQueueOfNullableObjectExtension on StreamQueue { + Future get nextAsInt async => ((await next) as num).toInt(); +}