From 3348bae5aa7446046bf8911f956a3fe855574c2a Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 8 Dec 2020 16:06:00 -0800 Subject: [PATCH] Pass a Uri to package:http APIs Prepare for https://github.com/dart-lang/http/issues/375 --- test/web_socket_test.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/web_socket_test.dart b/test/web_socket_test.dart index 94d82b4..68b8d3e 100644 --- a/test/web_socket_test.dart +++ b/test/web_socket_test.dart @@ -68,8 +68,8 @@ void main() { }); group('with a set of allowed origins', () { - var server; - var url; + HttpServer server; + Uri url; setUp(() async { server = await shelf_io.serve( webSocketHandler((webSocket) { @@ -77,7 +77,7 @@ void main() { }, allowedOrigins: ['pub.dartlang.org', 'GoOgLe.CoM']), 'localhost', 0); - url = 'http://localhost:${server.port}/'; + url = Uri.http('localhost:${server.port}', ''); }); tearDown(() => server.close()); @@ -117,7 +117,7 @@ void main() { webSocket.sink.close(); }), 'localhost', 0); - var url = 'http://localhost:${server.port}/'; + var url = Uri.https('localhost:${server.port}', ''); var headers = _handshakeHeaders; headers['Connection'] = 'Other-Token, Upgrade'; expect(http.get(url, headers: headers).whenComplete(server.close), @@ -125,13 +125,13 @@ void main() { }); group('HTTP errors', () { - var server; - var url; + HttpServer server; + Uri url; setUp(() async { server = await shelf_io.serve(webSocketHandler((_) { fail('should not create a WebSocket'); }), 'localhost', 0); - url = 'http://localhost:${server.port}/'; + url = Uri.http('localhost:${server.port}', ''); }); tearDown(() => server.close());